17.1k views
5 votes
What is the proper syntax for writing a while loop in Python?

A. Begin the statement with the keyword repeat
B. End the statement with a colon
C. Place the test condition outside of parentheses
D. Use quotation marks around the relational operators

1 Answer

4 votes

The proper syntax for while loops in Python are:

while (condition):

#the code does something

Answer choice B is the only correct option because all while loops end with a colon.

User Doublesharp
by
6.9k points