In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Most people do not understand the knowledge points of this article "how to create the sequence type of python range", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to create the sequence type of python range" article.
Sequence types (including lists, etc.) can use the operators in and not in to check whether the specified integer exists in the sequence of integers represented by the range object, 3 in range (5) checks whether it contains 3, and returns True
You can call the built-in function range (the constructor of class range) to create objects of type range
Range (stop)
Range (start, stop)
Range (start, stop, step)
The default value of the starting value of the integer sequence is 0, which can be specified using the parameter start
Use the parameter stop to specify the end value of the sequence; the rang object created does not contain stop
The default step size of an integer sequence is 1, which can be specified using the parameter step
The return value of the built-in function range is an iterator object, which can be converted into a list in order to clearly represent the sequence of integers represented by the returned iterator object
The advantage of the range type is that no matter how long the sequence of integers represented by range objects, all range objects occupy the same memory space, and only three parameters of start,stop,step need to be stored. It is only when the range object is used that you go back to calculate the relevant elements in the sequence
Range (5) # range (0,5)
List (range (5)) # converts range type objects to lists [0,1,2,3,4]
List (range (0,5,1)) # [0,1,2,3,4]
List (range (1,5)) # [1,2,3,4]
List (range (1d10, 2)) # [1, 3, 5, 7, 9]
List (range (0,-10,-2)) # [0,-2,-4,-6,-8]
Help (range) for more descriptions of range
The above is about the content of this article on "how to create the sequence type of python range". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.