22 lines
832 B
Python
22 lines
832 B
Python
def personal_info(name, **kwargs):
|
|
print(f"Name: {name}")
|
|
for key, value in kwargs.items():
|
|
print(f"{key.capitalize()}: {value}")
|
|
|
|
|
|
"""
|
|
Prints personal information including a required name and any number of additional keyword arguments.
|
|
Args:
|
|
name (str): The person's name.
|
|
**kwargs: Arbitrary keyword arguments representing additional personal information (e.g., surname, son, cats, breed).
|
|
kwargs.key is capitalized in the output.
|
|
Returns:
|
|
None
|
|
"""
|
|
# Example usage of the personal_info function
|
|
personal_info("Sarah", surname="Conor", son="John")
|
|
personal_info("Natalie", cats="3", breed="Maine Coon")
|
|
personal_info("John", surname="Doe", age=30, city="New York", occupation="Engineer")
|
|
personal_info("Alice", hobbies="reading, hiking", favorite_color="blue")
|
|
|