0
Unexpected behavior in python
Can someone explain me this python code: https://code.sololearn.com/cOkrZbVZ5d71. When I try to run this code on my PC it ask me to input something, but when I run it in Sololearn android app on my phone everithing is OK! Why this happend?
3 Réponses
0
is this what youre trying to do?:
age = int(input())
if age in range(0,15):
print("Child")
elif age in range(15,25):
print("Youth")
elif age in range(25,65):
print("Adult")
elif age >= 65:
print("Senior")
else:
print("Wrong input!")
0
No @Jake, in my code variable age is hardcoded with -10(age = -10). I just noticed that when i run the code in sololearn website it ask me to input some value, but when I run the same code in sololearn app on the phone that it's not happend. My question is why?
0
Kaloyan Kostov hmm, it does seem to be a bug, the compiler appears to be reading the string “input” as a function. I guess if you want to avoid this, simply capitalize the ‘i’ in “input”