Learn Python like a Professional! Take You from 0 to Hero
In this Python lecture, we will learn about the Range.
"Range() is used to create of a sequence of numbers between the start to the stop integer".
"Range() is used to create of a sequence of numbers between the start to the stop integer".
Let's see some example-
Range
Range
#create the sequence of every element from 0 to 6 (excluded) range(0,6)
#create the sequence of every 2nd element from 0 to 6 (excluded) range(0,6,2)
# create the list of element from 0 to 6 (excluded) list(range(0,6))
# create the list of every 2nd element from 0 to 6 (excluded) list(range(0,6,2))
# create the tuple of every element from 0 to 6 (excluded) tuple(range(0,6))
>> (0,1,2,3,4,5,6)
# create the tuple of every element from 0 to 6 (excluded) set(range(0,6))
# print the every element from 0 to 6(excluded) one by one for var in range(0,6): print(var)
1
2
3
4
5
#create the every 2nd element from 0 to 6(excluded) on by one
for var in range(0,6,2) :
print(var)
2
4
In the next Blog, we will discuss List Comprehension
https://sngurukuls247.blogspot.com/2018/09/python-ninja-bootcamp-20-list.html
......................................................................................................................................
Instagram-
https://www.instagram.com/python.india/
View the Jupyter Notebook for this lecture
Download the Jupyter Notebook for this lecture
https://sngurukuls247.blogspot.com/2018/09/python-ninja-bootcamp-20-list.html
......................................................................................................................................
Follow the link below to access Free Python Lectures-
https://www.youtube.com/channel/UCENc9qI7_r8KMf6-_1R1xnwInstagram-
https://www.instagram.com/python.india/
View the Jupyter Notebook for this lecture
Feel free contact me on-
Email - sn.gurukul24.7uk@gmail.com
No comments:
Post a Comment