Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 48)
48.
How can you read an integer from the console and check if it is within a specific range?
check_range(input())
number = int(input("Enter a number: ")); print("Within range" if 1 <= number <= 10 else "Out of range")
range_check = lambda x: 1 <= x <= 10
validate_range(input())
Answer: Option
Explanation:
To read an integer from the console and check if it is within a specific range, use conditional statements with the int() function.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.