mardi 22 mai 2018

If statement getting ignored in python [duplicate]

This question already has an answer here:

I am trying to make this simple game in python but whatever I write inside if statement just gets ignored.

import random
b=input("Select your difficulty (1,2,3) ")
if b==1:
    print ("you selected easy.")
    c=input("Enter a number ")
    d=random.randint(0,1)
    if c==d:
        print("Congratulations! You win.")
        if c!=d:
            print ("You lose")

Aucun commentaire:

Enregistrer un commentaire