Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to concatenate two strings.
Python
result = "Hello, " [1] "World!" print(result)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using * instead of + for joining strings.
โ Incorrect
Use the + operator to join two strings together.
2fill in blank
mediumComplete 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'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using + instead of * for repeating strings.
โ Incorrect
The * operator repeats a string a given number of times.
3fill in blank
hardFix 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'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using * instead of + inside the parentheses.
โ Incorrect
Use + to join "Hi" and "! ", then * to repeat the whole string 2 times.
4fill in blank
hardFill 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'
Attempts:
3 left
๐ก Hint
Common Mistakes
Swapping the operators or using subtraction/division.
โ Incorrect
Use + to join "Go" and "! ", then * to repeat the whole string 4 times.
5fill in blank
hardFill 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'
Attempts:
3 left
๐ก Hint
Common Mistakes
Using subtraction instead of concatenation or repetition.
โ Incorrect
First, use + to add a space after "Wow", then * to repeat the string 3 times.