Exercise
Functions Exercise
In this exercise, you’ll create a function that takes a user's name, age, and favorite number, and prints a formatted greeting.
Task
Write a Python program that:
- Defines a function
greet_userthat takesname,age, andfav_numberas parameters - Prints a greeting like "Hello Alice! You are 20 years old and your favorite number is 7."
- Calls the function with user input
Hints
- Use the
defkeyword to define the function - Use
input()to get user data - Use
print()with formatted strings
Example Output