Created
March 23, 2021 06:48
-
-
Save AnisahTiaraPratiwi/fa229a7a7e3100df587e9842ae6df4f1 to your computer and use it in GitHub Desktop.
Question 6 The guest_list function reads in a list of tuples with the name, age, and profession of each party guest, and prints the sentence "Guest is X years old and works as __." for each one. For example, guest_list(('Ken', 30, "Chef"), ("Pat", 35, 'Lawyer'), ('Amanda', 25, "Engineer")) should print out: Ken is 30 years old and works as Chef.…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def guest_list(guests): | |
for name, age, job in guests: | |
print("{} is {} years old and works as {}".format(name, age, job)) | |
guest_list([('Ken', 30, "Chef"), ("Pat", 35, 'Lawyer'), ('Amanda', 25, "Engineer")]) | |
#Click Run to submit code | |
""" | |
Output should match: | |
Ken is 30 years old and works as Chef | |
Pat is 35 years old and works as Lawyer | |
Amanda is 25 years old and works as Engineer | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment