write a python program which accepts an integer value as command line and print "OK" if value is between 1 to 50 (both inclusive);otherwise it prints "out of range"
Answers
Answered by
3
a=int(input('enter the number'))
if a>=0 and a<=50:
print('OK')
else:
print('out of range')
Answered by
0
Answer:
enter the number12
OK
enter the number89
out of range
Explanation:
Code:
z=int(input('enter the number'))
if z>=0 and a<=50:
print('OK')
else:
print('out of range')
Code Explanation:
- The program will asks the user to type any number.
- After taking the number it will stored in the variable z.
- Then the value of the variable z check to the IF condition.
- If the number between 1 to 50 it prints OK.
- If the number below 1 and above 50 it will print out of range.
#SPJ2
Similar questions