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?

31st May 2019, 8:15 PM
Kaloyan Kostov
Kaloyan Kostov - avatar
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!")
31st May 2019, 9:19 PM
Jake
Jake - avatar
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?
31st May 2019, 9:32 PM
Kaloyan Kostov
Kaloyan Kostov - avatar
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”
1st Jun 2019, 12:50 AM
Jake
Jake - avatar