vendredi 21 juillet 2017

Python, if-else statement error

import time
import random
print("Welcome to double up!")
pscore = 1
pscore = str(pscore)
print("Your current balance is "+pscore+", would you like to double or 
quit?")
while pscore != 0:
    pscore = str(pscore)
    print("Your current balance is "+pscore+"!")
    pscore = int(pscore)
    choice = input("d/q :")
        if choice == ("d")or("D"): #later simplify cases
        luck = random.randint(1,100)
        if luck > 75:
            print("Upgrade failed!")
            pscore = 0
        else:
            print("Upgrade complete!")
            pscore = pscore * 2
    else: #ERROR
        print("Incorrect command! Please retry!")

The code line tagged with #ERROR doesn't run, no matter what I input as the variable 'choice' any help?

I would also welcome anything I can do to help cleanup my code, very new :p

http://ift.tt/2ujnFQZ - The code as I messed up formatting on this site

Aucun commentaire:

Enregistrer un commentaire