92.1k views
4 votes
Part 1

Make a class with a favorite hobby and have a description of the hobby and an ID (as an integer. Please store numbers in this data for the class and if you get numbers input from the user make sure to cast them to integer before you store them. Searches work better comparing numbers.) It should have an ID, one other stored variable, and you only need to code the __init__ constructor. Make 3 different objects of your class and store them in a list. Write a binary and a linear search. Ask the user for an ID and tell the user if its in the List or not.

1 Answer

2 votes

Final answer:

The question is about creating a class with a favorite hobby, description, and ID, and implementing binary and linear search methods to find a specific ID in a list.

Step-by-step explanation:

The subject of this question is Computers and Technology and the grade level is High School. The question is asking to create a class with a favorite hobby, description of the hobby, and an ID as an integer.

The __init__ constructor should be coded to initialize the objects. Three different objects should be created and stored in a list. Both binary and linear search methods need to be implemented to check if the user-input ID is present in the list or not.

User Patrick Karcher
by
8.4k points