+ 1
Diagnose this code
https://code.sololearn.com/c4l1a2Oodrwl/?ref=app Whatâs wrong with this code? Why do I get an error?
3 Answers
+ 6
num = int(input("enter integer between 1 and 10 to win a million dollars: "))
if num == 3:
print("congratulations! you won a million dollars")
print("Program ended")
Actually in python we don't need to define the type of variable ie. int(num) but instead of this we need to define the type of input i.e. int(input())
And in the 2nd line in , if statement there should be 2 equal to sign(=) as we are equating the num with 3.
Thanks
+ 1
it worked, thanks for your input. pun intended
+ 1
Daniel đđwelcomeđđ