samedi 27 février 2016

Python if else statement

My if statement works but else doesn't can anyone help me? this is my code. Btw if anyone knows how to ask for a retry after one time would be awesome!

import random

print('choose a number between 1 and 10,if you guess right you get 10 points if you guess wrong you lose 15points')

answer = input()

randint = random.randint(0,2)

print('the answer is ',randint)

if [answer == randint]:

 print('gratz! you win 10points!')

else:

 print('you lose 15points!')

Aucun commentaire:

Enregistrer un commentaire