zoukankan      html  css  js  c++  java
  • Python(24)_格式化输出

    #-*-coding:utf-8-*-
    '''
    The use of format
    %s The use of %s 
    '''
    name = input("Input your name:")
    age  = input("Input your age:")
    height = input("Input your height:")
    msg = '我叫%s,今年%s 高%s'%(name,age,height)
    print(msg)


    #-*-coding:utf-8-*-
    '''
    The use of format
    %s The use of %s
    '''
    name = input("Input your name:")
    age  = input("Input your age:")
    job  = input("Input your work:")
    hobbie = input("Input your hobbie:")
    msg = '''---------------------index of %s -------------
    Name   :  %s
    Age    :  %d
    Job    :  %s
    Hobbie :  %s
    ---------------------end --------------------------''' %(name,name,int(age),job,hobbie)
    
    print(msg)

       二、 三次登录程序优化


    #-*-coding:utf-8-*-
    '''
    '''
    i=0
    username = 'bowen'
    password = '123'
    while i<3:
        name = input('Input your name:')
        pwd  = input('Input your password:')
        if username == name and password == pwd:
            print("Congrations,Login in Success!")
            break
        else:
            print('failed to login in,you still have %d times to try ' %(2-i))
            if(2-i)==0:
                result = input("You still want to try?Y or N")
                if result == 'Y':
                    i==0
                    continue
        i +=1
    else:print('fuck you!')

    这是对昨天的那个while程序的优化。输入三次错误的。最后不管是输入Y还是N,都会弹出fuck you

  • 相关阅读:
    3. 尾缀
    Cocos工程命名规则整理(node部分)
    3.1-3.3 HBase Shell创建表
    2.11-2.12 HBase的数据迁移常见方式
    2.8-2.10 HBase集成MapReduce
    2.7 HBase架构深入剖析
    2.3-2.6 HBase java API
    2.1-2.2 HBase数据存储
    1.6-1.8 HBase表的物理模型
    1.4-1.5 HBase部署及基本使用
  • 原文地址:https://www.cnblogs.com/sunnybowen/p/10197614.html
Copyright © 2011-2022 走看看