Title: Python range() Function Explained with Examples
Open Graph Title: Python range() Explained with Examples
Description: Python range() returns the sequence of numbers starting from a given start integer to a stop integer, which we can iterate using a for loop
Open Graph Description: Python range() returns the sequence of numbers starting from a given start integer to a stop integer, which we can iterate using a for loop
Opengraph URL: https://pynative.com/python-range-function/
X: @PyNative
Domain: pynative.com
{"@context":"https://schema.org","@graph":[{"@type":"Article","@id":"https://pynative.com/python-range-function/#article","isPartOf":{"@id":"https://pynative.com/python-range-function/"},"author":{"name":"Vishal","@id":"https://pynative.com/#/schema/person/64b55d5bde2265918c5a9931de4de71f"},"headline":"Python range() Explained with Examples","datePublished":"2018-06-03T23:33:41+00:00","dateModified":"2022-03-17T11:46:35+00:00","mainEntityOfPage":{"@id":"https://pynative.com/python-range-function/"},"wordCount":2723,"commentCount":55,"publisher":{"@id":"https://pynative.com/#/schema/person/64b55d5bde2265918c5a9931de4de71f"},"image":{"@id":"https://pynative.com/python-range-function/#primaryimage"},"thumbnailUrl":"https://pynative.com/wp-content/uploads/2019/02/python_range.png","keywords":["Python Basics"],"articleSection":["Python","Python Basics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https://pynative.com/python-range-function/#respond"]}],"accessibilityFeature":["tableOfContents"]},{"@type":["WebPage","FAQPage"],"@id":"https://pynative.com/python-range-function/","url":"https://pynative.com/python-range-function/","name":"Python range() Function Explained with Examples","isPartOf":{"@id":"https://pynative.com/#website"},"primaryImageOfPage":{"@id":"https://pynative.com/python-range-function/#primaryimage"},"image":{"@id":"https://pynative.com/python-range-function/#primaryimage"},"thumbnailUrl":"https://pynative.com/wp-content/uploads/2019/02/python_range.png","datePublished":"2018-06-03T23:33:41+00:00","dateModified":"2022-03-17T11:46:35+00:00","description":"Python range() returns the sequence of numbers starting from a given start integer to a stop integer, which we can iterate using a for loop","breadcrumb":{"@id":"https://pynative.com/python-range-function/#breadcrumb"},"mainEntity":[{"@id":"https://pynative.com/python-range-function/#faq-question-1613126022244"},{"@id":"https://pynative.com/python-range-function/#faq-question-1613126083356"},{"@id":"https://pynative.com/python-range-function/#faq-question-1613126134925"},{"@id":"https://pynative.com/python-range-function/#faq-question-1613126371761"}],"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https://pynative.com/python-range-function/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https://pynative.com/python-range-function/#primaryimage","url":"https://pynative.com/wp-content/uploads/2019/02/python_range.png","contentUrl":"https://pynative.com/wp-content/uploads/2019/02/python_range.png","width":304,"height":237,"caption":"Python range"},{"@type":"BreadcrumbList","@id":"https://pynative.com/python-range-function/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://pynative.com/"},{"@type":"ListItem","position":2,"name":"Python","item":"https://pynative.com/python/"},{"@type":"ListItem","position":3,"name":"Python range() Explained with Examples"}]},{"@type":"WebSite","@id":"https://pynative.com/#website","url":"https://pynative.com/","name":"PYnative","description":"Python Programming","publisher":{"@id":"https://pynative.com/#/schema/person/64b55d5bde2265918c5a9931de4de71f"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://pynative.com/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https://pynative.com/#/schema/person/64b55d5bde2265918c5a9931de4de71f","name":"Vishal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https://pynative.com/#/schema/person/image/","url":"https://pynative.com/wp-content/uploads/2019/01/vishalHule.jpg","contentUrl":"https://pynative.com/wp-content/uploads/2019/01/vishalHule.jpg","width":968,"height":1065,"caption":"Vishal"},"logo":{"@id":"https://pynative.com/#/schema/person/image/"},"description":"Founder of PYnative.com. I am a Python developer and I love to write articles to help developers. | All the best for your future Python endeavors!","sameAs":["https://pynative.com"]},{"@type":"Question","@id":"https://pynative.com/python-range-function/#faq-question-1613126022244","position":1,"url":"https://pynative.com/python-range-function/#faq-question-1613126022244","name":"Does range() in Python start at 0?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The range() by default starts at 0, not 1, if the start argument is not specified. For example, range(5) will return 0, 1, 2, 3, 4.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https://pynative.com/python-range-function/#faq-question-1613126083356","position":2,"url":"https://pynative.com/python-range-function/#faq-question-1613126083356","name":"What does range() return in Python?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"The range() function returns an object of class range, which is nothing but a series of integer numbers.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https://pynative.com/python-range-function/#faq-question-1613126134925","position":3,"url":"https://pynative.com/python-range-function/#faq-question-1613126134925","name":"Is range a list in Python?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"No. range() is not a list, nor it returns a list type. A range() return range object. You can verify the data type of range() using the type(range(5)) function.","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"Question","@id":"https://pynative.com/python-range-function/#faq-question-1613126371761","position":4,"url":"https://pynative.com/python-range-function/#faq-question-1613126371761","name":"How do you sum a range() in Python?","answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"Use bulit-in function sum(). For example, sum(range(10)","inLanguage":"en-US"},"inLanguage":"en-US"},{"@type":"HowTo","@id":"https://pynative.com/python-range-function/#howto-1","name":"Python range() Explained with Examples","mainEntityOfPage":{"@id":"https://pynative.com/python-range-function/#article"},"description":"The range() function generates a sequence of integer numbers as per the argument passed. The below steps show how to use the range() function in Python.","step":[{"@type":"HowToStep","url":"https://pynative.com/python-range-function/#how-to-step-1613131643771","name":"Pass start and stop values to range()","itemListElement":[{"@type":"HowToDirection","text":"For example, range(0, 6). Here, start=0 and stop = 6. It will generate integers starting from the start number to stop -1. i.e., [0, 1, 2, 3, 4, 5]"}]},{"@type":"HowToStep","url":"https://pynative.com/python-range-function/#how-to-step-1613131994596","name":"Pass the step value to range()","itemListElement":[{"@type":"HowToDirection","text":"The step Specify the increment. For example, range(0, 6, 2). Here, step = 2. Result is [0, 2, 4]"}]},{"@type":"HowToStep","url":"https://pynative.com/python-range-function/#how-to-step-1613131850967","name":"Use for loop to access each number","itemListElement":[{"@type":"HowToDirection","text":"Use for loop to iterate and access a sequence of numbers returned by a range()."}]}],"inLanguage":"en-US"}]}
| og:locale | en_US |
| og:type | article |
| og:site_name | PYnative |
| article:published_time | 2018-06-03T23:33:41+00:00 |
| article:modified_time | 2022-03-17T11:46:35+00:00 |
| og:image | https://pynative.com/wp-content/uploads/2019/02/python_range.png |
| og:image:width | 304 |
| og:image:height | 237 |
| og:image:type | image/png |
| author | Vishal |
| twitter:card | summary_large_image |
| twitter:creator | @PyNative |
| twitter:label1 | Written by |
| twitter:data1 | Vishal |
| twitter:label2 | Est. reading time |
| twitter:data2 | 19 minutes |
| msapplication-TileImage | https://pynative.com/wp-content/uploads/2018/06/cropped-favicon-270x270.png |
| None | https://pynative.com/?s={s} |
Links:
Viewport: width=device-width, initial-scale=1
Robots: noai, noimageai