div { display:none; }

Trending technologies

#AWS #Azure #Blockchain #IOT #machine learning #Virtual Reality #Analytics #Business Intelligence

Tutorials

Blogs

For-loop (or simply for loop) is a control flow statement for specifying iteration, which allows code to be executed repeatedly.

For Loop Example

fruits = ["apple", "banana", "cherry"]
for x in fruits:
print(x)

’’’ Iterating String

for x in "banana":
  print(x)

Introduction to For Loop

For Loop

For Loop Simplified

Range() Function in python

The built-in range function in Python is very useful to generate sequences of numbers in the form of a list. The given end point is never part of the generated list.

Example

for x in range(6):
print(x)

Output:
0
1
2
3
4
5

Imp: Range(N) It will start from 0 and end at N-1 and will increment by 1.

Example: Range (6) means values from 0 to 5.

Imp: Range(M,N) It will Start from M and end at N-1 and will Increment by 1.

Example: Range (3,6) means values from 3 to 5.

Imp: Range(M,N,L) It will Start from M and end at N-1 and will Increment by L.

Example: Range (0,6,2) means values from 0 to 5 and will increment by 2.

Range Function Live

Range Function

error: Content is protected !!