Question: Step 1 : Producing correct output Three commented - out lines of code exist in the main part of the program. Uncomment the lines and

Step 1: Producing correct
output
Three commented-out lines of code exist in the main part of the program. Uncomment the lines and click the "Run program" button.
Verify that the program's output is:
2+2=4
Unknown method: print_plus_2
Secret string: "abc"
Submit your code for grading. Your submission will pass the "Compare output" test only, achieving 1 of the possible 10 points.
Step 2: Inspecting the LabPrinter class
Inspect the LabPrinter class implemented in the
LabPrinter.py file. Access
LabPrinter.py by clicking on the orange arrow next to
IntroToDSELabs.py at the top of the coding window. Instance methods print_2_plus_2() and print_secret () print strings
using print ().
Step 3: Implementing call_method_named()
Remove the three uncommented lines from the main part of the program. Then implement the call_method_named () function in
IntroToDSELabs.py to handle three cases:
If method_name is "print_2_plus_2", call printer's print_2_plus_2() instance method.
If method_name is "print_secret", call printer's print_secret () instance method.
If method_name is anything other than the two strings mentioned above, print "Unknown method: xyz", where xyz is
method_name's value.
After implementing call_method_named (), click the "Run program" button. Verify that the program's output is, once again:
 Step 1: Producing correct output Three commented-out lines of code exist

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!