0

If statements in python

My code is posted down below, I’m trying to make a blackjack game where it posts two random numbers. After this I want to have an if statement to see if you won, tied, or lost. I’m pretty new at python but don’t know what’s wrong with the if statement I have. https://code.sololearn.com/cPzSWbM0ts1B/?ref=app

29th Mar 2020, 6:48 PM
Stephen
Stephen - avatar
2 Antworten
0
import random options = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] print ("The dealers number is") dealer_hand = random.choice(options) print (dealer_hand ) print ("your number is") player_hand = random.choice(options) print (player_hand) if dealer_hand > player_hand: print("YOU LOST") elif dealer_hand == player_hand: print("YOU TIED") else: print("YOU WON") Do you need an explanation?
29th Mar 2020, 6:57 PM
Steppenwolf
Steppenwolf - avatar
0
I tried and each time I run it it prints ypu tied no matter the cards.
30th Mar 2020, 1:55 AM
Stephen
Stephen - avatar