Home > Article > Backend Development > An example of python built-in variables
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!