Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

What is Range Function? | Range in Python Explained | Edureka

99 views

Published on

YouTube Link: https://youtu.be/0Hp7AThTZhQ
** Python Certification Training: https://www.edureka.co/data-science-python-certification-course **
This Edureka video on 'Range In Python' will help you understand how we can use Range Function in Python with various examples for better understanding. Following are the topics discussed:

What Is Range In Python?
Range Parameters
Range With For Loop
Float Numbers In Range
Reverse Range In Python
Range vs XRange
Range Function Examples
Points To Remember

Follow us to never miss an update in the future.
YouTube: https://www.youtube.com/user/edurekaIN
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
Castbox: https://castbox.fm/networks/505?country=in

Published in: Technology
  • Be the first to comment

  • Be the first to like this

What is Range Function? | Range in Python Explained | Edureka

  1. 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
  2. 2. What Is Range In Python? Range Parameters Range With For Loop www.edureka.co/python Float Numbers In Range Reverse Range In Python Range vs XRange Range Function Examples Points To Remember
  3. 3. www.edureka.co/python
  4. 4. www.edureka.co/python 10 62 3 4 50 Start Stop
  5. 5. www.edureka.co/python
  6. 6. Range Parameters www.edureka.co/python • A web-crawler is also known as a web spider, automatic indexer or simply crawler. • It is an internet bot that helps in web indexing • Web crawlers helps in collecting information from a webpage and the links related to them • It also helps in validating HTML code and hyperlinks. • They crawl one page at a time until all the pages are indexed. Start: Starting point of the sequence Step: Number of times the skip will happen Stop: Ending point of the sequence
  7. 7. www.edureka.co/python
  8. 8. Range With For Loop www.edureka.co/python To install scrapy, simply run the following command in the command prompt or in the terminal, or simply you can add the package from the project interpreter too. for i in range(0,10): print(i, end=“,”) #this will print the numbers from 0-9
  9. 9. www.edureka.co/python
  10. 10. Float Numbers In Range www.edureka.co/python def frange(start, stop, step): i = start while i < stop: yield i i+= step for i in frange(0.5, 1.0, 0.1): print(i , end=“,”)
  11. 11. www.edureka.co/python
  12. 12. Reverse Range In Python www.edureka.co/python for i in range(5,0,-1): print(i , end=“,” #the output will be 5,4,3,2,1
  13. 13. www.edureka.co/python
  14. 14. Range vs XRange www.edureka.co/python The major difference between range and xrange is that range returns a python list object and xrange returns a xrange object. If you require to iterate over a sequence multiple times, it’s better to use range instead of xrange. For the most part, range and xrange basically do the same functionality of providing a sequence of numbers in order however a user pleases. In python 3, xrange does not exist anymore, so it is ideal to use range instead. Any way we can use the 2to3 tool that python provides to convert your code.
  15. 15. www.edureka.co/python
  16. 16. Range Function Examples www.edureka.co/python Run the following command: scrapy crawl spidername –o spidername.json Concatenating Two Range Functions Accessing Range Function Using Indexes Converting Range To List
  17. 17. www.edureka.co/python
  18. 18. Points To Remember www.edureka.co/python The range function in python only works with integers or whole numbers. Arguments passed in the range function cannot be any other data type other than an integer data type. All three arguments passed can be either positive or negative integers. Step argument value cannot be zero otherwise it will throw a ValueError exception. The range function in python is also one of the data types. You can access the elements in a range function using index values, just like a list data type.
  19. 19. Copyright © 2017, edureka and/or its affiliates. All rights reserved. www.edureka.co
  20. 20. www.edureka.co/python

×