-
-
Notifications
You must be signed in to change notification settings - Fork 49k
Closed
Labels
enhancementThis PR modified some existing filesThis PR modified some existing files
Description
Feature description
def get_age_input():
age_input = input("Enter your age: ")
if age_input.isdigit():
age = int(age_input)
print(f"Your age is {age}")
else:
print("age is not valid")
get_age_input()
What this does:
-
Takes input from the user.
-
Checks if the input only contains digits using .isdigit().
-
If it is digits, it converts it to an int and prints it.
-
If it’s not (e.g., letters, special characters), it prints "age is not valid".
Metadata
Metadata
Assignees
Labels
enhancementThis PR modified some existing filesThis PR modified some existing files