while loops in python 3 part-5

Published: 01 January 2018
on channel: Cook The Code
8
0

A while loop statement in Python programming language repeatedly executes a target statement as long as a given condition is true.

Syntax
The syntax of a while loop in Python programming language is −

while expression:
statement(s)
Here, statement(s) may be a single statement or a block of statements.

Example
#!/usr/bin/python

count = 0
while (count less then 9):
print 'The count is:', count
count = count + 1

print "Good bye!"

When the above code is executed, it produces the following result −

The count is: 0
The count is: 1
The count is: 2
The count is: 3
The count is: 4
The count is: 5
The count is: 6
The count is: 7
The count is: 8
Good bye!


Watch video while loops in python 3 part-5 online, duration hours minute second in high quality that is uploaded to the channel Cook The Code 01 January 2018. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 8 times and liked it 0 visitors.