🌍 All Study Guides📊 Dashboard📰 Blog💡 About
Google Advanced Data Analytics Professional Certificate • STUDY MODE

TEST YOUR KNOWLEDGE: WHILE LOOPS

QUESTION 1 OF 3

Fill in the blank: A while loop instructs your computer to continuously execute your code based on the value of a _____.

A
data type
B
conditionCorrect Answer
C
function
D
comparator
Explanation:

A while loop instructs your computer to continuously execute your code based on the value of a condition. The loop will keep iterating as long as the condition remains true.

QUESTION 2 OF 3

A data professional wants to set up a while loop that will iterate as long as the variable x is less than 7. They assign the value 0 to the variable x. What code should they write next?

A
while x < 7:Correct Answer
B
iterate x < 7:
C
repeat x < 7:
D
loop x < 7:
Explanation:

The code while x < 7: sets a condition for a while loop stating that the variable x must be less than 7. The code begins with the distinguishing keyword while. And, like functions and other expressions that start a distinct code block, it ends with a colon. The while loop will iterate until the condition is false.

QUESTION 3 OF 3

In Python, the keyword break lets you escape a loop without triggering any else statement that follows it in the loop.

A
TrueCorrect Answer
B
False
Explanation:

In Python, the keyword break lets you escape a loop without triggering any else statement that follows it in the loop.

Ready to test your recall?

Fill in the blank: A while loop instructs your computer to continuously execute your code based on the value of a _____.

A
data type
B
condition
C
function
D
comparator

How confident are you in this answer?