+ 1
[SOLVED] Some help, please (python)
Hello, i want to make a basic input and range operation and i just can't do it! range 1 should be from 1 to 1000 and range 2 from 1001 to 2000. when user inputs 700 (example) print low, when he inputs 1700 print high. that's it. can't do it, driving me nuts any answer is appreciated
4 Réponses
+ 19
1)first take a user input & store it in a variable .. a
2)if(a<=1000&& a>0) print "low"
3) else if (a>=1001 && a <2001) print "high"
+ 6
It's a one-liner.
print('low' if int(input('>')) <= 1000 else 'high')
+ 1
it's like this, now working
user_input = int(input())
if user_input <= 1000 and user_input > 0:
print ("low")
elif user_input >= 1001 and user_input < 2001:
print("high")
i've tried all this few hours ago but i've omitted that you have to specify what input you want, integer in this case.
thanks for your help.
0
i've adapted to python like so, doesn't work. i've adapted wrong probably.
user_input = input()
if (user_input <= 1000 and user_input > 0):
print ("low")
elif (user_input >= 1001 and user_input < 2001):
print("high")