0
0
Intro to Computingfundamentals~10 mins

Why algorithms are step-by-step solutions in Intro to Computing - Test Your Understanding

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

Complete the code to show the first step in an algorithm to add two numbers.

Intro to Computing
result = num1 [1] num2
Drag options to blanks, or click blank then click option'
A-
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using '-' instead of '+' will subtract instead of add.
2fill in blank
medium

Complete the code to show the next step: checking if the result is greater than 10.

Intro to Computing
if result [1] 10:
    print('Result is large')
Drag options to blanks, or click blank then click option'
A>
B<
C==
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' will check if result is less than 10, which is not what we want here.
3fill in blank
hard

Fix the error in the step that repeats printing numbers from 1 to 5.

Intro to Computing
for i in [1](1, 6):
    print(i)
Drag options to blanks, or click blank then click option'
Alist
Bloop
Carray
Drange
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'list' or 'array' will cause errors because they don't generate sequences like 'range'.
4fill in blank
hard

Fill both blanks to create a step-by-step filter for even numbers in a list.

Intro to Computing
evens = [num for num in numbers if num [1] 2 == [2]]
Drag options to blanks, or click blank then click option'
A%
B0
C1
D//
Attempts:
3 left
💡 Hint
Common Mistakes
Using '//' instead of '%' will do floor division, not remainder.
5fill in blank
hard

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

Intro to Computing
lengths = {: {BLANK_2}} for [2] in words if len({{BLANK_3}}) > 3
Drag options to blanks, or click blank then click option'
Aword
Blen(word)
D{
Attempts:
3 left
💡 Hint
Common Mistakes
Not using curly braces will cause syntax errors.