0
Any python coders..I've faced a problem...in this program, if statement to be executed but not...why?resolve plz
import random from random import randrange a=[5,6,9,8] print(random.choice(a)) b=randrange(2) print(b) print(randrange(200)) c=input("Enter the number:") if b==c: print("You have Entered Correct Number") else: print("Good try..!!") print("But answer is",b) OUTPUT: 6 0 129 Enter the number:0 Good try..!! But answer is 0
2 Respuestas
+ 6
I'm not a Python guy, but by a glance I assume the issue is that c is a String.
(input("") returns a String)
Convert it to an int (number) to compare it with b.
Like this:
c = int(input("Enter a number."))
0
oooh..okay I'll check...thakss