0
0
Intro to Computingfundamentals~10 mins

Bug tracking and fixing in Intro to Computing - Interactive Code Practice

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

Complete the code to print the value of variable count.

Intro to Computing
count = 5
print([1])
Drag options to blanks, or click blank then click option'
ACount
Bcout
Ccount
Dcnt
Attempts:
3 left
💡 Hint
Common Mistakes
Using a misspelled variable name causes a NameError.
Ignoring case sensitivity leads to errors.
2fill in blank
medium

Complete the code to fix the syntax error in the if statement.

Intro to Computing
number = 10
if number [1] 5:
    print("Greater than 5")
Drag options to blanks, or click blank then click option'
A=
B==
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using single equals = instead of comparison operators.
Confusing equality == with greater than >.
3fill in blank
hard

Fix the error in the loop to correctly print numbers from 0 to 4.

Intro to Computing
for i in range([1]):
    print(i)
Drag options to blanks, or click blank then click option'
A4
B5
C6
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 4 in range excludes the number 4 from output.
Confusing inclusive and exclusive ranges.
4fill in blank
hard

Fill both blanks to create a dictionary of squares for numbers greater than 2.

Intro to Computing
squares = {x: x[1]2 for x in range(1, 6) if x [2] 2}
Drag options to blanks, or click blank then click option'
A**
B>
C<
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using * instead of ** for squaring.
Using < instead of > in the condition.
5fill in blank
hard

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

Intro to Computing
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 k instead of k.upper() for keys.
Using < or == instead of > in condition.