Greet User by Age
Beginner
Let's create a fun function that greets users based on their age! Your task is to write a function called greet_by_age that takes a user's age and returns a greeting message based on how old they are.
Here's how your function should work:
- If the age is 0 or below, return "Hello! Welcome to the world!"
- If the age is between 1 and 12 (inclusive), return "Hey kid!"
- If the age is between 13 and 19 (inclusive), return "What's up, teen?"
- If the age is 20 or above, return "Hello adult!"
Examples
print(greet_by_age(0)) # Output: "Hello! Welcome to the world!" print(greet_by_age(5)) # Output: "Hey kid!" print(greet_by_age(16)) # Output: "What's up, teen?" print(greet_by_age(25)) # Output: "Hello adult!"
Ready to make some friends with your function? 😀
Inputs
Arg 1:
0Expected Output
"Hello! Welcome to the world!"Actual Output