String Concatenation, online
Six activities your students do on their own devices. See who's finished, and their scores.
Learning
Understanding
Testing
String Concatenation in one minute
What students need to know
Adding ' ' between strings inserts a space in the result. Variables holding strings can be concatenated with +.
There's already a space inside 'Hi ' — it gets joined to 'there'. name holds 'Alice', so 'Hi ' + name is 'Hi ' + 'Alice' = 'Hi Alice'.
Mistakes students make
- Line 3 is missing the + operator. Use: first + second.
- Line 2 uses Name with a capital N. Python is case-sensitive. Use: name.
- Line 3 is missing a space before fruit. Use: count + " " + fruit.
- Line 3 has a comma without quotes. Use: city + ", " + country.
PREVIOUS · MODULE 6Basic Arithmetic
YOU ARE HERE · MODULE 7String Concatenation
NEXT · MODULE 8String Repetition
What students will learn in this module
Every question in Module 7
Quick questions
- What is
"Hello" + "World"?AHelloWorldBHello World - What is
"Hi " + "there"?AHi thereBHithere - After
name = "Alice", what is"Hi " + name?AHi nameBHi Alice - What is
"Good" + "bye"?AGoodbyeBGood bye - What is
"Hello" + " " + "World"?AHelloWorldBHello World
Key terms
Students type the meaning of:
"Hello" + "World""Hello" + " " + "World"name = "Alice""Hi " + name
Match the pairs
'Hello' + 5Match it to what it doesname = 'Ali'
print('Hi' + name)Match it to what it does'Hello' + ' ' + 'World'Match it to what it doesgreeting = 'Hi ' result = greeting + 'Bob'Match it to what it does
print('cat' + 'nap')Match it to what it doesa = 'Hot' b = 'Dog' print(a + b)Match it to what it does
Fill in the blanks
result = "Hello" _ "World"
name = "Alice" message = "Hi " _ name print(message)
greeting = "Good" + _ _ + "morning"
first = "Bob" last = "Smith" fullname = first + " " + ____
city = "Melbourne" sentence = "I live in " + ____ print(sentence)
Spot the error
Question 1
Afirst = "Hello"Bsecond = "World"Cresult = first secondDprint(result)
Question 2
Aname = "Bob"Bgreeting = "Hi " + NameCprint(greeting)
Question 3
Afruit = "apple"Bcount = "3"Cmsg = "I have " + count + fruitDprint(msg)
Question 4
Acity = "Melbourne"Bcountry = "Australia"Clocation = city + , + countryDprint(location)
Question 5
Aword = "Hello"Bsentence = word + " " + "World"Cprint(Sentence)
