0
0
Raspberry Piprogramming~10 mins

Why automation runs tasks without human intervention in Raspberry Pi - Test Your Understanding

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

Complete the code to print a message automatically.

Raspberry Pi
print([1])
Drag options to blanks, or click blank then click option'
A"Hello, world!"
BHello, world!
Cprint
Dmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the text.
2fill in blank
medium

Complete the code to run a task every 5 seconds.

Raspberry Pi
import time
while True:
    print("Task running")
    time.[1](5)
Drag options to blanks, or click blank then click option'
Asleep
Bpause
Cwait
Ddelay
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong function name like wait or delay.
3fill in blank
hard

Fix the error in the code to automate a task without stopping.

Raspberry Pi
count = 0
while count < 3:
    print("Running task", count)
    count [1] 1
Drag options to blanks, or click blank then click option'
A==
B+=
C-=
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using == instead of += causes no change in count.
4fill in blank
hard

Fill both blanks to create a dictionary of tasks that run only if active.

Raspberry Pi
tasks = {task: status for task, status in [1] if status [2] True}
Drag options to blanks, or click blank then click option'
Atask_list
Btasks.items()
C==
Dis
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of 'is' for boolean check.
5fill in blank
hard

Fill all three blanks to filter and square numbers automatically.

Raspberry Pi
result = [1]: [2]**2 for [3] in numbers if [2] % 2 == 0
Drag options to blanks, or click blank then click option'
Anum
Dnumber
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names causes errors.