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
To combine two strings, you __________ them. | concatenate | ^ *concatenate *$ | |
Strings have been assigned to the variables a and b. Concatenate them and assign the result to the variable c. | c = a + b | ^ *c = a \+ b *$ | |
Concatenate "Mr. " and "Brown". Assign the result to the variable person. | person = "Mr. " + "Brown" | person `= `"`Mr. `" `+ `"`Brown`" | |
Concatenate first_string and second_string. Assign the result to the variable combo. | combo = first_string + second_string | combo = first_string + second_string | |
Concatenate "Hello, " and "world!". Assign the result to a variable. Make up the variable name. Don't forget the space at the end of the first string. | greeting = "Hello, " + "world!" | ^ *[a-zA-Z_][a-zA-Z0-9_]* = •Hello, • \+ •world!• *$ | |
Concatenate three variables. Assign the result to a fourth variable. Make up the variable names. | a = b + c + d | ^ *[a-zA-Z_][a-zA-Z0-9_]* = [a-zA-Z_][a-zA-Z0-9_]* \+ [a-zA-Z_][a-zA-Z0-9_]* \+ [a-zA-Z_][a-zA-Z0-9_]* *$ | |
Concatenate three strings: your first name, a space, and your last name. Assign the result to a variable. Make up the variable name. | my_name = "Mark" + " " + "Myers" | ^ *[a-zA-Z_][a-zA-Z0-9_]* = •.*• \+ • • \+ •.*• *$ | |
Give yourself a fancy title, like Sir Mark or Lady Judith. Concatenate the title plus a space plus your first name. Assign the result to a variable. Make up the variable name. | personage = "Grand Duke" + " " + "Mark" | ^ *[a-zA-Z_][a-zA-Z0-9_]* = •.*• \+ • • \+ •.*• *$ | |
Give yourself a fancy title. But this time include the space in the first string. So you'll be concatenating the title and space as the first string, and your first name as the second string. Assign the result to a variable. Make up the variable name. | personage = "Grand Duke " + "Mark" | ^ *[a-zA-Z_][a-zA-Z0-9_]* = •.* • \+ •.*• *$ | |
In a single statement, tell Python to display the concatenation of two variables. Make up the variable names. | print(first_string + second_string) | ^ *print\([a-zA-Z_][a-zA-Z0-9_]* \+ [a-zA-Z_][a-zA-Z0-9_]*\) *$ | |
| cb7babb4b1 | ||
| c48f6a4368 |