Question
I'm writing a code for an assignment. I already wrote a get_course_ids portion. The course Id's are [52,15,23,34]. Can someone help me write the portion
I'm writing a code for an assignment. I already wrote a get_course_ids portion. The course Id's are [52,15,23,34]. Can someone help me write the portion called choose_course that Consumes a list of integers representing course IDs and prompts the user to enter a valid ID, and then returns an integer representing the user's chosen course ID. If the user does not enter a valid ID, the function repeatedly loops until they type in a valid ID. You will need to use the input function to get the user's choice.
The code I wrote for the get_course_ID consumes a list of Course dictionaries and returns a list of integers representing course IDs:
# 5) get_course_ids def get_course_ids(available_courses): course_ids = [] for ids in available_courses: course_ids.append(ids['id']) return course_ids print(course_ids)
Now I need the choose_course ID
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