Home  >  Article  >  Backend Development  >  An example of python built-in variables

An example of python built-in variables

PHP中文网
PHP中文网Original
2017-06-21 13:16:53956browse

1. The simple explanation is: reverse a sequence object

Example 1:

def fun3():
x = [3,6,9]
for i in reversed(x):
print(i,end=',')
fun3()

Output:

》》》9 ,6,3,

Example 2:

>>> a = range(5)
>>> a
range(0, 5)
>>> list(a)
[0, 1, 2, 3, 4]
>>> a1 = reversed(a)
>>> list(a1)
[4, 3, 2, 1, 0]

The above is the detailed content of An example of python built-in variables. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn