Ask Question
17 February, 23:45

A line of code that begins with the while needs to end which symbol?

#

"

:

.

+3
Answers (1)
  1. 18 February, 00:21
    0
    A line of code that begins with the "while" needs to end with ":" symbol

    Explanation:

    In python, the while loop statement has ":" at the end of the line.

    Syntax:

    while expression:

    code (s) or statement (s)

    Example:

    cnt = 0

    while (cnt < 5):

    print 'cnt:', cnt

    cnt = cnt + 1

    Like other programming languages, while loop works in the same way except that in python it comes alone with "else" statement. When the condition is false, "else" statement gets executed.

    Example:

    #!/usr/bin/python

    cnt = 0

    while cnt < 5:

    print cnt, " is less than 5"

    cnt = cnt + 1

    else:

    print cnt, " is not less than 5"
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “A line of code that begins with the while needs to end which symbol? # " : . ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers