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

  • 相关阅读:
    InPut 标签 HTML(表单)
    JavaScript Table 对象
    JCBD
    JCBD
    JavaScript prototype 属性
    Java8 新特性
    JavaScript 对象的使用
    Java 反射
    虚拟机VirtualBox启动虚拟机报Only Ethernet Adapter' (VERR_INTNET_FLT_IF_NOT_FOUND).
    Impala 数值函数
  • 原文地址:https://www.cnblogs.com/sunnybowen/p/10197614.html
Copyright © 2011-2022 走看看