1
2
3
4
5
6
7
8
9
10
11
12
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to Trinket.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11
0
0
0
0
A function within a class definition is a _______. | method | ^ *method *$ | |
In the following code, the part after the dot is the method call. What is the part before the dot? (1 word) | prod88.calc() | instance | ^ *.*instance *$ |
Call the method named analyze for the instance named i9877 | i9877.analyze() | i9877`.`analyze`(`) | |
Call the method named eval for the instance named score | score.eval() | score.eval() | |
Call a method. Make up the name of the instance and the name of the method. | score.eval() | ^ *[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*\(\) *$ | |
Re-code this function call as a method call. | capitalize(a4056.first_name, a4056.last_name) | a4056.capitalize() | ^ *a4056\.capitalize\(\) *$ |
Code a method call with a single positional argument that's a string. Make everything up. | cust4056.check_status("Cairo") | ^ *[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*\(•.+•\) *$ | |
Code a method call with two arguments. The first is a positional argument that's an integer. The second argument is a keyword argument whose value is an integer. Make everything up. | cust4056.check_status(50987, flight_number = 1038) | ^ *[a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*\(-?[0-9]+, [a-zA-Z_][a-zA-Z0-9_]* = -?[0-9]+\) *$ | |
The method calc returns a value. Call it, assigning the returned value to a variable. Make up the name of the instance and the name of the variable. | total = order1050.calc() | ^ *[a-zA-Z_][a-zA-Z0-9_]* = [a-zA-Z_][a-zA-Z0-9_]*\.calc\(\) *$ | |
In a single line display the value returned by a method call. Make everything up. | print(cust777.calc()) | ^ *print\([a-zA-Z_][a-zA-Z0-9_]*\.[a-zA-Z_][a-zA-Z0-9_]*\(\)\) *$ | |
|
f30f98d8cd | ||
|
2327389957 |