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

hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 » pythOn for循环