0
0
Pythonprogramming~10 mins

String concatenation and repetition in Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to concatenate two strings.

Python
result = "Hello, " [1] "World!"
print(result)
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using * instead of + for joining strings.
2fill in blank
medium

Complete the code to repeat the string 3 times.

Python
result = "ha" [1] 3
print(result)
Drag options to blanks, or click blank then click option'
A*
B+
C-
D/
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using + instead of * for repeating strings.
3fill in blank
hard

Fix the error in the code to concatenate and repeat strings correctly.

Python
result = ("Hi" [1] "! ") [2] 2
print(result)
Drag options to blanks, or click blank then click option'
A/
B*
C-
D+
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using * instead of + inside the parentheses.
4fill in blank
hard

Fill both blanks to create a string that repeats 'Go!' 4 times with spaces.

Python
result = ("Go" [1] "! ") [2] 4
print(result)
Drag options to blanks, or click blank then click option'
A+
B*
C-
D/
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Swapping the operators or using subtraction/division.
5fill in blank
hard

Fill all three blanks to create a string with 'Wow' repeated 3 times, separated by spaces.

Python
result = ("[1]" [2] " ") [3] 3
print(result)
Drag options to blanks, or click blank then click option'
AWow
B+
C*
D-
Attempts:
3 left
๐Ÿ’ก Hint
Common Mistakes
Using subtraction instead of concatenation or repetition.