Complete the code to print a greeting in Python.
print([1])
In Python, text must be inside quotes to be printed as a string.
Complete the code to create a variable named 'age' with value 25.
age = [1]Numbers are written without quotes in Python when assigned as numbers.
Fix the error in the code to print the value of variable 'name'.
name = "Alice" print([1])
To print the value of a variable, use the variable name without quotes.
Fill both blanks to create a list of numbers from 1 to 5.
numbers = [[1] for [2] in range(1, 6)]
The variable 'x' is used to represent each number in the list comprehension, and 'i' is the loop variable.
Here, 'x' is the element and 'i' is the variable iterating over the range.
Fill all three blanks to create a dictionary with keys as uppercase letters and values as their lengths from a list.
words = ["apple", "bat", "cat"] lengths = {{ [1] }}: [2] for [3] in words}
We use 'word' as the loop variable to go through each word.
For each word, the key is the uppercase version using 'word.upper()'.
The value is the length of the word using 'len(word)'.