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
What is this? (one word) | def greeting(): print("Hello, World!") |
function | ^ *function *$ |
There's a mistake in the second line. It should be _________. (one word) | def greeting(): print("Hello, World!") |
indented | ^ *indented *$ |
Type the last three characters of this line. | def greeting____ | (): | (`)`: |
Type the first three characters of this function definition. | ___ greeting(): | def | def |
Code the first line of a function definition. Make up the name of the function. (Remember, the name of a function has to be a legal variable name.) | def add_numbers(): | ^ *def [a-zA-Z_][a-zA-Z0-9_]*\(\): *$ | |
Turn this code into a function. Make up the name of the function. Remember to indent correctly. | total = 2 + 2 | def add_em(): total = 2 + 2 |
^ *def [a-zA-Z_][a-zA-Z0-9_]*\(\):\n total = 2 \+ 2 *$ |
Code a function that displays the concatenation of two strings. Make everything up. | def greet_combo(): print("Hello, " + "World!") |
^ *def [a-zA-Z_][a-zA-Z0-9_]*\(\):\n print\(•.+• \+ •.+•\) *$ | |
Call the function named greet. | greet() | ^ *greet\(\) *$ | |
Code a function that tests whether a equals b and, if so, displays ("ok"). Make up the name of the function. | def check(): if a == b: print("ok") |
^ *def [a-zA-Z_][a-zA-Z0-9_]*\(\):\n if a == b:\n print\(•ok•\) *$ | |
Call a function. Make up its name. | save_the_world() | ^ *[a-zA-Z_][a-zA-Z0-9_]*\(\) *$ | |
|
be2b4bf7f3 | ||
|
1dd2e2d948 |