lab_cards/fingers.py

34 lines
1.1 KiB
Python

class finger:
def __init__(self, state):
self.state = state
def __str__(self):
return self.state
def __repr__(self):
return f"{self.state}"
playspace=[]
for i in range(10):
playspace.append(finger("up"))
print(playspace)
choice1 = int(input("Pick a finger you would like to put down (a number between 1 and 10)."))
while playspace[choice1-1].state != "up":
print("That finger is already down.")
choice1 = int(input("Pick a finger you would like to put down (a number between 1 and 10)."))
if choice1-2 >= 0:
if playspace[choice1-2].state == "up":
print("You may choose to put down finger "+str(choice1-2))
if choice1 < 10:
if playspace[choice1].state == "up":
print("or you may choose to put down finger "+str(choice1))
if choice1 < 10:
if playspace[choice1].state == "up":
print("You may choose to put down finger "+str(choice1-2))
if choice1 < 10:
if playspace[choice1].state == "up":
print("or you may choose to put down finger "+str(choice1))