Complete the code to create a string variable named greeting with the value 'Hello'.
greeting = [1]Strings are written inside quotes. Here, "Hello" is a string.
Complete the code to print the string stored in the variable message.
message = "Welcome" print([1])
To print the value of a variable, use its name without quotes inside print().
Fix the error in the code to concatenate two strings stored in variables first and last.
first = "John" last = "Doe" full_name = first [1] last print(full_name)
The plus sign (+) joins two strings together in Python.
Fill both blanks to create a dictionary with words as keys and their lengths as values.
words = ["apple", "bat", "car"] lengths = {word: [1] for word in words if len(word) [2] 3}
len(word) gets the length of each word. The condition filters words longer than 3 letters.
Fill all three blanks to create a dictionary with uppercase words as keys and their lengths as values for words longer than 2 letters.
words = ["dog", "cat", "a"] result = { [1]: [2] for w in words if len(w) [3] 2 }
w.upper() converts words to uppercase for keys, len(w) gives their length, and > 2 filters words longer than 2 letters.