hey guys- brand new to the forum, let me know if i’m not doing something correctly.
When the player loses I want it to not ask the player if they want to draw another card.
import random
lose = 'You Lose!'
point = 'You Got a Point!'
numPoints = 0
numloops = [0]
for i in numloops:
cards = [point, point, point, lose]
random.shuffle(cards)
print(cards)
PChoice = input('Which card do you want to choose?(1, 2, 3 or 4): ')
if (PChoice == '1' and cards[0] == point):
numPoints += 1
if (PChoice == '2' and cards[1] == point):
numPoints += 1
if (PChoice == '3' and cards[2] == point):
numPoints += 1
if (PChoice == '4' and cards[3] == point):
numPoints += 1
if (PChoice == '1'):
print(cards[0])
if (PChoice == '2'):
print(cards[1])
if (PChoice == '3'):
print(cards[2])
if (PChoice == '4'):
print(cards[3])
if (PChoice != '1' and PChoice != '2' and PChoice != '3' and PChoice != '4'):
print('Please Input 1, 2, 3, 4.')
quit = input('Would you like to guess a card(yes/no): ')
if (quit == 'no'):
print('your score is,')
print(numPoints)
print('if you got one of the top ten high scores please show Avery.')
if (quit == 'yes'):
numloops.append(0)
if (quit != 'yes' and quit != 'no'):
print('Please type yes or no.')
if (PChoice == '1' and cards[0] == lose):
numloops.clear
if (PChoice == '2' and cards[1] == lose):
numloops.clear
if (PChoice == '3' and cards[2] == lose):
numloops.clear
if (PChoice == '4' and cards[3] == lose):
numloops.clear
I am having problems placing the promt “quit = input('Would you like to guess a card(yes/no): ')”, do you know where I would put it?
import random
lose = 'You Lose!'
point = 'You Got a Point!'
numPoints = 0
numloops = [0]
for i in numloops:
cards = [point, point, point, lose]
random.shuffle(cards)
PChoice = input('Which card do you want to choose?(1, 2, 3 or 4): ')
if (PChoice == '1' and cards[0] == point):
numPoints += 1
if (PChoice == '2' and cards[1] == point):
numPoints += 1
if (PChoice == '3' and cards[2] == point):
numPoints += 1
if (PChoice == '4' and cards[3] == point):
numPoints += 1
if (PChoice == '1'):
print(cards[0])
if (PChoice == '2'):
print(cards[1])
if (PChoice == '3'):
print(cards[2])
if (PChoice == '4'):
print(cards[3])
if (PChoice != '1' and PChoice != '2' and PChoice != '3' and PChoice != '4'):
print('Please Input 1, 2, 3, 4.')
if (PChoice == '1' and cards[0] == lose):
numloops.clear()
if (PChoice == '2' and cards[1] == lose):
numloops.clear()
if (PChoice == '3' and cards[2] == lose):
numloops.clear()
if (PChoice == '4' and cards[3] == lose):
numloops.clear()
quit = input('Would you like to guess a card(yes/no): ')
if (quit == 'no'):
print('your score is,')
print(numPoints)
print('if you got one of the top ten high scores please show Avery.')
if (quit == 'yes'):
numloops.append(0)
if (quit != 'yes' and quit != 'no'):
print('Please type yes or no.')