0
0
Pythonprogramming~10 mins

Why input and output are required in Python - Test Your Understanding

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

Complete the code to get a number from the user.

Python
number = [1]("Enter a number: ")
Drag options to blanks, or click blank then click option'
Ainput
Bprint
Clen
Drange
Attempts:
3 left
💡 Hint
Common Mistakes
Using print instead of input.
Forgetting to put parentheses after the function name.
2fill in blank
medium

Complete the code to show the message on the screen.

Python
[1]("Hello, friend!")
Drag options to blanks, or click blank then click option'
Ainput
Bprint
Clen
Dopen
Attempts:
3 left
💡 Hint
Common Mistakes
Using input instead of print.
Forgetting to put parentheses after the function name.
3fill in blank
hard

Fix the error in the code to get a number and print it.

Python
num = [1]("Type a number: ")
print(num)
Drag options to blanks, or click blank then click option'
Aprint
Bint
Cstr
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Using print instead of input.
Trying to convert input without first reading it.
4fill in blank
hard

Fill both blanks to create a dictionary of word lengths for words longer than 3 letters.

Python
lengths = {word: [1] for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of > in the condition.
Putting the word itself instead of its length in the dictionary.
5fill in blank
hard

Fill all three blanks to create a dictionary with uppercase keys and values greater than 0.

Python
result = {{ { [1] }: { [2] } for k, v in data.items() if v [3] 0 }
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk
Attempts:
3 left
💡 Hint
Common Mistakes
Using < instead of > in the condition.
Using k instead of k.upper() for keys.