Whats wrong here.. showing error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whats wrong here.. showing error

x = input() y = x if y > 18 : print('you cant access in this program') else: print('you are welcome')

8th May 2020, 7:59 PM
Bad Boy BB
Bad Boy BB - avatar
5 Answers
+ 1
int(input()) input returns string
8th May 2020, 8:03 PM
Abhay
Abhay - avatar
+ 1
else: is indented in your code but it should start level with the if above it. if y > 18: print(...) else: print(...)
8th May 2020, 8:04 PM
Russ
Russ - avatar
0
Here, input gives string, so you should use X= int(input)
8th May 2020, 11:31 PM
Sâñtôsh
Sâñtôsh - avatar
0
I got the 2nd one.. what about 1st error
9th May 2020, 2:44 AM
Bad Boy BB
Bad Boy BB - avatar
0
int(input()) if y>18: print(....) else: print(...)
10th May 2020, 2:23 PM
Asrar
Asrar - avatar