Question: PYTHON CLASS Will like if you answer please. [5 pts] Now implement a less_by_id() function which will compare two Person objects by their ID, and

PYTHON CLASS

Will like if you answer please.

PYTHON CLASS Will like if you answer please. [5 pts] Now implement

[5 pts] Now implement a less_by_id() function which will compare two Person objects by their ID, and a less_by_name) function which will compare two Person objects by their names. () # Put your comparison functions here. Test code below. Do not change. 0 1 = [Person(3, "Joe"), Person(2, "Alice"), Person (4, "Mike"), Person(1, "Jane") } print(1) for ein 1: print(e) print (sort(l, less_by_id)) print (sortil, loss_by_namo) ) [25 pts) For this next problem, write a simulation of the Monty Hall problem. Implement the simulation as a function named monty) that takes two parameters. The first parameter is the number of trials, and the second parameter is whether or not to switch doors after Monty reveals the door containing the goat. A few functions that you may need include: random. rendint() random. sample) random.shuffle() I also suggest that you use the Python set sequence class. [5 pts] Now implement a less_by_id() function which will compare two Person objects by their ID, and a less_by_name) function which will compare two Person objects by their names. () # Put your comparison functions here. Test code below. Do not change. 0 1 = [Person(3, "Joe"), Person(2, "Alice"), Person (4, "Mike"), Person(1, "Jane") } print(1) for ein 1: print(e) print (sort(l, less_by_id)) print (sortil, loss_by_namo) ) [25 pts) For this next problem, write a simulation of the Monty Hall problem. Implement the simulation as a function named monty) that takes two parameters. The first parameter is the number of trials, and the second parameter is whether or not to switch doors after Monty reveals the door containing the goat. A few functions that you may need include: random. rendint() random. sample) random.shuffle() I also suggest that you use the Python set sequence class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!