Question: Let's wrap up with a function: ask _ questions ( ) . from operator import itemgetter def ask _ questions ( ) - > List
Let's wrap up with a function: askquestions
from operator import itemgetter
def askquestions ListListstr:
pass
Let's see an example:
printaskquestions
What is your name? Sir Robin
What is your quest? To seek the Holy Grail
What is your favorite color? red
What is your name? Matt
What is your quest? to travel the world
What is your favorite color? blue
What is your name? Alexander
What is your quest? to invent the universe
What is your favorite color? silver
Mattto travel the world', 'blue'Sir Robin', To seek the Holy Grail', 'red'Alexanderto invent the universe', 'silver'
This should:
Request the name, quest, and favorite color three times
Save intermediate results to a list
Sort the list in alphabetical order based on the color. Hint: skim the operator.itemgetter
Links to an external site. documentation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
