Complete the code to print the words separated by a space.
print('Hello', 'World', sep=[1])
The sep parameter defines the separator between items. Using a space ' ' prints words separated by a space.
Complete the code to print numbers on the same line separated by a dash.
print(1, 2, 3, sep=[1], end='\n')
The sep parameter sets the separator between printed items. Using '-' prints numbers separated by dashes.
Fix the error in the code to print two words without a space between them.
print('Hello', 'World', sep=[1])
Using an empty string '' as the separator prints words directly next to each other without spaces.
Fill both blanks to print numbers 1 to 3 separated by a comma and ending with an exclamation mark.
print(1, 2, 3, sep=[1], end=[2])
The sep parameter sets commas between numbers, and end adds an exclamation mark at the end instead of a newline.
Fill all three blanks to create a dictionary comprehension that maps uppercase words to their lengths, only for words longer than 3 letters.
result = { [1]: [2] for word in words if len(word) [3] 3 }This comprehension creates keys as uppercase words and values as their lengths, filtering words longer than 3 letters.