Ask Question
24 March, 04:49

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

#

"

:

.

+5
Answers (1)
  1. 24 March, 07:47
    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?
Find an answer to your question ✅ “A line of code that begins with the while needs to end which symbol? # " : . ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers