+ 1

Diagnose this code

https://code.sololearn.com/c4l1a2Oodrwl/?ref=app What’s wrong with this code? Why do I get an error?

28th May 2019, 5:21 AM
Daniel
Daniel - avatar
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
28th May 2019, 5:29 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar
+ 1
it worked, thanks for your input. pun intended
29th May 2019, 5:32 AM
Daniel
Daniel - avatar
+ 1
Daniel 👍👍welcome😊😊
29th May 2019, 5:46 AM
Prince PS[Not_Active]
Prince PS[Not_Active] - avatar