Lecture # 11 - While Loop
Abdullah Bin Altaf
1 min read
Table of contents
while Loop:
In Python, a while
loop is used to execute a block of code repeatedly as long as a specified condition is true.
Syntax:
while condition:
#Code to be executed repeatedly as long as the condition is true
Example:
i = 1
num = int(input("Enter a Number:"))
while i <= 10:
print(str(num) + " X " + str(i) + " = " + str(num * i))
i += 1
Output:
0
Subscribe to my newsletter
Read articles from Abdullah Bin Altaf directly inside your inbox. Subscribe to the newsletter, and don't miss out.
DevopsPythonPython 3python beginnerpython projectsProgramming BlogsProgramming Tipsprogramming languagesProgramming Schoolwhile loop
Written by