-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLoops.py
More file actions
25 lines (18 loc) · 722 Bytes
/
Loops.py
File metadata and controls
25 lines (18 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Python programming language provides the following types of loops to handle looping requirements. Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition-checking time.
# 1 -> For Loop
print("\n\n This is Example of While For In Python")
for i in range(0,100):
print(i)
for i in range(0,100,3):#print every 3rd element from 0-99
print(i)
# loops in string
str = "Lokesh Singh"
# Example of for-in Loop in python
for character in str:
print(character)
# 2 -> While Loop
print("\n\n This is Example of While loop In Python")
i = 0
while(i<=10):
print(i)
i = i+1 #Python doesn't support i++