0
0
Pythonprogramming~10 mins

What is Python - Interactive Quiz & Practice

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

Complete the code to print a greeting in Python.

Python
print([1])
Drag options to blanks, or click blank then click option'
Aprint
BHello, world!
C"Hello, world!"
Dgreeting
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the text.
Trying to print a word without quotes.
2fill in blank
medium

Complete the code to create a variable named 'age' with value 25.

Python
age = [1]
Drag options to blanks, or click blank then click option'
A25
Btwenty-five
Cage
D"25"
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers inside quotes makes them strings.
Using words instead of numbers.
3fill in blank
hard

Fix the error in the code to print the value of variable 'name'.

Python
name = "Alice"
print([1])
Drag options to blanks, or click blank then click option'
A"name"
BName
Cprint
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around the variable name prints the word, not the value.
Using a different variable name with wrong case.
4fill in blank
hard

Fill both blanks to create a list of numbers from 1 to 5.

Python
numbers = [[1] for [2] in range(1, 6)]
Drag options to blanks, or click blank then click option'
Ax
B1
Cx**2
Di
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number instead of a variable name in the loop.
Using the wrong variable name in the expression.
5fill in blank
hard

Fill all three blanks to create a dictionary with keys as uppercase letters and values as their lengths from a list.

Python
words = ["apple", "bat", "cat"]
lengths = {{ [1] }}: [2] for [3] in words}
Drag options to blanks, or click blank then click option'
Aword.upper()
Blen(word)
Cword
Dw
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different variable name than in the loop.
Not using the upper() method for keys.
Using the word itself as value instead of length.