range after Python for loop () function of a number of instructions

Our common

for i in range(10)

However, for the range function must be later than, range () only for the purpose of generating a digital iterables, in other words, any object can be used for loop iteration, such as a list, the elements, dictionaries.

Example
Example 1

for letter in 'Python':
	print('当前字母:'+letter)

Here Insert Picture Description
Example 2

fruits=['banana','apple','mango']
for fruit in fruits:
	print('当前水果:'+fruit)

Here Insert Picture Description

Published 13 original articles · won praise 0 · Views 2611

Guess you like

Origin blog.csdn.net/Heiraten/article/details/104398899