zoukankan      html  css  js  c++  java
  • 0X06遍历列表

    # -*- coding:utf-8 -*-
    #!/usr/bin/python
    
    '''
    一;遍历整个列表
    '''
    
    '''
    使用for循环来遍历列表内容
    '''
    
    magicians = ['alice','david','carolina']
    
    for i in magicians:
        print(i)
    
    '''
    1;在for循环中执行更多的操作
        在for 循环中,想包含多少行代码都可以。在代码行for a in magicians 后面,每个缩进的代码行都是循环的一部分,且将针对列表中的每个值都执行一次。因此,可对列表中的每个值执行任意次数的操
    '''
    
    for a in magicians:
        print(a.title() + ", that was a great trick!")
        print("I can't wait to see. your next trick, " + a.title() + ".
    ")
  • 相关阅读:
    bzoj 5455
    hdu 6705
    hdu 6706
    斜率优化
    bzoj3672
    bzoj1367
    bzoj2118
    bzoj2337
    Codeforces 1077D Cutting Out(二分答案)
    Codeforces 1079C Playing Piano(记忆化搜索)
  • 原文地址:https://www.cnblogs.com/aaron456-rgv/p/12613237.html
Copyright © 2011-2022 走看看