pythOn for循环
pythOn for循环
- for animal in animals:
- ??print(animal)
注意两点一个是注意加冒号;一个是只有命令行前面有空格才能执行循环(不管几个空格)
例题4-2
animals = [‘pig‘,‘dog‘,‘cat‘]
for animal in animals:
print(‘A ‘ + animal + "would make a great pet")
print(‘Any of these animals would make a great pet!‘)
pythOn for循环
原文地址:https://www.cnblogs.com/yhzhao1/p/13321648.html