What's wrong with my program? Here is my code , if the user wants a 3rd card dealt they, have to select yes and the total will b
e for 3 cards. If they don't, then the total is for 2 cards.? I also need to print the total for both the dealer and the user and determine the winner of the game?
# import random
import random
def main():
# greet the user
print("Hello! Welcome to my card game!")
# deal the user a random card between 1 and 10
num1 = random.randint(1,10)
print("You drew a", num1)
# deal the user another random card (between 1 and two)
num2 = random.randint(1,10)
print("You drew a", num2)
num3 = random.randint(1,10)
# deal the user a third card?
again = input("Would you like to draw a 3rd card? Y or N? ")
d_total = random.randint(10,21)
u_total = (num1) + (num2) + (num3)
u_total1 = (num1) + (num2)
if again == "Y" or "y":
print("You drew a", num3)
if (u_total > d_total) and (u_total < 21):
# the user wins
print("Congratulations! You won!")
print("You drew a",num1,",", "a",num2,"," "and a",num3, "for a total of",u_total)
if again == "N" or "n":
print("You drew a", num1,"and a",num2, "for a total of",u_total1)
if (u_total > d_total) and (u_total < 21):
print("The dealer's total is", d_total)
else:
print("Sorry! You lose.")
main()