Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1def calculate_average(marks): | AFunction name mixes capital letters with underscores. It should be snake_case: calculate_total. | |
| 2class StudentRecord: | Bclass BankAccount: | |
| 3Function and method names use snake_case and start with a verb | Cdef get_total(self): | |
| 4Class names use CamelCase nouns | DClass name uses snake_case. It should be CamelCase: StudentRecord. | |
| 5def Calculate_Total(prices): | EA function named in snake_case with a verb that says what it does | |
| 6class student_record: | FA class named in CamelCase with a noun that says what it represents |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
naming convention — A consistent rule for naming code structures: snake_case verbs for functions and methods (get_total), CamelCase nouns for classes (StudentRecord). Pick one style and stick to it.def get_total(prices):
return sum(prices)
print(get_total([2, 3]))class StudentRecord:
pass
record = StudentRecord()import data_tools
total = data_tools.get_total(marks)class Student:
def get_name(self): pass
Student().get_name()class Student:
pass
s = Student()