Script
#!/usr/local/bin/python3.7
print()
value = int(input("Please enter an integer in the range 0 to 100: "))
print()
if value >= 0:
if value <= 100:
print(value, "is between 0 and 100 and is in the acceptable range")
else:
print(value, "is greater than 100 and outside the acceptable range")
else:
print(value, "is too small")
print()
print("Done")
print()
Execution
Please enter an integer in the range 0 to 100: 69
69 is between 0 and 100 and is in the acceptable range
Done
Please enter an integer in the range 0 to 100: -34
-34 is too small
Done
Please enter an integer in the range 0 to 100: 529
529 is greater than 100 and outside the acceptable range
Done
#!/usr/local/bin/python3.7
print()
value = int(input("Please enter an integer in the range 0 to 100: "))
print()
if value >= 0:
if value <= 100:
print(value, "is between 0 and 100 and is in the acceptable range")
else:
print(value, "is greater than 100 and outside the acceptable range")
else:
print(value, "is too small")
print()
print("Done")
print()
Execution
Please enter an integer in the range 0 to 100: 69
69 is between 0 and 100 and is in the acceptable range
Done
Please enter an integer in the range 0 to 100: -34
-34 is too small
Done
Please enter an integer in the range 0 to 100: 529
529 is greater than 100 and outside the acceptable range
Done
No comments:
Post a Comment