Ask your own question, for FREE!
Computer Science 15 Online
Gucchi:

Read the following code: x = 1 (x < 26): print(x) x = x + 1 There is an error in the while loop. What should be fixed? Add quotation marks around the relational operator Begin the statement with the proper keyword to start the loop Change the parentheses around the test condition to quotation marks Change the colon to a semicolon at the end of the statement

Gucchi:

Am I right with D?

Gucchi:

@vocaloid

Vocaloid:

python uses colons for loops, not semi-colons, so it wouldn't be D however, if you want to use a while loop, you need the word "while" in front of the condition

Gucchi:

hmm so C?

Vocaloid:

not quite, for python you use parentheses around the condition not quotation marks think about the other example: it didn't just say (n < 5), it said while (n < 5) "while" is the keyword to start the loop, so choice B

Gucchi:

oohh ok thank you

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!