+ 1

Code error

import random numbers = [1,2,3,4,5,6,7,8,9,10] x = random.randint(0, 10) guess = int(input ("Choose a number between 1 and 10: ")) if guess < 0 print ("Too low!") if guess > 10 print ("Too high!") if guess == x print ("You won!") else: print ("You lost.") # Thanks guys! check out my game: https://code.sololearn.com/cEhCVol8Owx8/#py

25th Nov 2017, 6:11 PM
Brian Baker
Brian Baker - avatar
4 Antworten
+ 4
: missing after if statements.
25th Nov 2017, 5:59 AM
Meharban Singh
Meharban Singh - avatar
+ 5
You forgot to end line 10 with a colon 😉
25th Nov 2017, 8:18 AM
David Ashton
David Ashton - avatar
0
# In addition to Meharban Singh # First, why did you declared numbers = [1,2,3,4,5,6,7,9,10] # Second, why did you included 0 in x = random.randint(0,10) # Third, not an error, but the probability of winning is only 10%, why so low ??😲
25th Nov 2017, 6:36 AM
#RahulVerma
#RahulVerma - avatar
0
To RahulVerma, This is a simple American game, in which one guesses a number the operator had chosen. The 0 inside the random number picker is a starting point, and is not included in the range. The percentage of winning is rather reasonable. Have you ever been to a casino?
25th Nov 2017, 6:13 PM
Brian Baker
Brian Baker - avatar