-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpick_up_sticks_bad.py
38 lines (31 loc) · 1.26 KB
/
pick_up_sticks_bad.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Pick Up Sticks: A Two Player Game
# Each player takes turns picking up between 1 and 3 sticks at a time.
# The player to pick up the last stick from the pile wins!
# Instructions:
# Pretend you are the Python interpreter reading this program line-by-line.
# Identify each error and categorize it as a syntax error (SE), runtime error (RE), or logic error (LE).
# Next, run the program to see how Python reacts to the error, read the entire error message,
# and then debug the error so the program works as intended.
import Random
MAX TAKE == 4
"1" = MIN_TAKE
sticks = random.randrange(5;30)
player = A
print "Welcome to Pick Up Sticks!"
print("\mEach player takes turns picking up from", MIN_TAKE)
print("to", MAX_TAKE, "sticks from a pile of, sticks, "sticks.")
print("Whoever picks up the last stick wins.")
while Sticks:
print("\nThere are", sticks, "stick(s) left./n")
print("Player:", player)
take = int(input("How many sticks will you take? ")
while take > sticks and take > MAX_TAKE or take < MIN_TAKE:
primt("You can't take", take, "sticks.")
take = input("How many sticks will you take? ")
sticks -= take
if not sticks:
print("Slayer", player, "wins!")
if player == 1:
player == 2
else
player = 1: