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 main(): | ACalls the main function once at the end of the file to start the program | |
| 2main() | Bmain() is called before it is defined, which causes a NameError. Move main() to the end of the file, after all the functions. | |
| 3Helper functions are defined above main, so they already exist when main runs | Cdef greet(): print("Hi!") def main(): greet() | |
| 4The program starts by calling main() once at the very end of the file, with no indent | Ddef main(): print("Start") main() | |
| 5def main(): print("Start") | Emain() is never called, so the program does nothing. Add main() at the end of the file with no indent. | |
| 6main() def greet(): print("Hi!") def main(): greet() | FDefines the main function that holds the main steps of the program |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
def main(): — Defines a function called main that holds the main steps of your program. You call main() once at the end of the file, after the other functions are defined, to start the program.def main():
print("Let's go!")
main()def main():
print("Start")
main()def main():
print("Game on")
main()def main():
print("Hello")
main()def main():
print("Welcome")
main()