Question: MY CODE: cardsValues = list(range(1, 50)) moves = [3, 2] player1_score = 0 player2_score = 0 flips = 50 while flips flips = flips -
![MY CODE: cardsValues = list(range(1, 50)) moves = [3, 2] player1_score](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3a73bdd72f_09166f3a73b629d5.jpg)
MY CODE:
cardsValues = list(range(1, 50))
moves = [3, 2]
player1_score = 0
player2_score = 0
flips = 50
while flips
flips = flips - 1
while True:
print("Player-1's turn")
card = int(input("Pick a Card 1-50: "))
print("Before going flip the coin! ")
card_head_tail = int(input("Please choose 1 for head or 0 for tail of the card: "))
input("press any key to flip the coin: ")
coin_flip = random.randint(0, 1)
if coin_flip == card_head_tail:
player1_score = player1_score + moves[0]
print(player1_score)
break
else:
player1_score = player1_score - moves[1]
print(player1_score)
break
while True:
print("Player-2's turn")
card = int(input("Pick a Card 1-50: "))
print("Before going to flip the coin ")
card_head_tail = int(input("Please choose 1 for head or 0 for tail of the card: "))
input("press any key to flip the coin: ")
coin_flip = random.randint(0, 1)
if coin_flip == card_head_tail:
player2_score = player2_score + moves[0]
print(player2_score)
break
else:
player2_score = player2_score - moves[1]
print(player2_score)
break
if player1_score == 30:
print("Player-1 won")
break
elif player2_score == 30:
print("Player-2 won")
break
else:
print("Game draw!")
What am I doing wrong?
this is basically my game | Intro To Game (1.) The player/user grabs a card from the deck (2.) The card will have heads or tails. Whichever card the user receives will determine his next move (3.) The player will flip the coin after picking a card. (4.) Once the player has flip his/her if it lands on the side that the cards says than the player moves 3 spaces. (5.) if the coin lands on the opposite side and not the same as the card they drew then the player will go back two spaces. (5.) when either player hits 30 points they will win (edited) this is basically my game | Intro To Game (1.) The player/user grabs a card from the deck (2.) The card will have heads or tails. Whichever card the user receives will determine his next move (3.) The player will flip the coin after picking a card. (4.) Once the player has flip his/her if it lands on the side that the cards says than the player moves 3 spaces. (5.) if the coin lands on the opposite side and not the same as the card they drew then the player will go back two spaces. (5.) when either player hits 30 points they will win (edited)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
