Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started