Final answer:
The Python exercise requires the creation of a program that can search through three different types of collections based on user input, report the index of a found value, and handle errors for robustness.
Step-by-step explanation:
To complete the Python exercise described, we need to write a program that can search through three different collections: a list of strings containing the uppercase letters of the alphabet, a list of integers from 1 to 100, and a list of floating-point numbers. First, the program will prompt the user to select which list to search. Then, the user will be asked to input the value they wish to find. Depending on the user's choice of list, the search will be performed, and the program will print the result, including the list where the search occurred and the index of the found value. If the value is not found, an appropriate message should be displayed. To ensure robustness, the program should handle errors such as invalid input.
Here is a simplified example of how the code might be structured to handle the user's requests robustly:
Python Code Example:
def search_collection(collection, target):
for index, value in enumerate(collection):
if value == target:
return index
return -1The code defines a function search_collection() that takes a collection and a target value, searches for the target, and returns the index or -1 if not found.