zoukankan      html  css  js  c++  java
  • 四、python用户交互程序

    一、注释

    1、单行,代码注释:#

     2、多行注释:三个引号(单引号、或双引号)

     3、三个单引号,赋予个变量,打印,又可用作:多行打印

     4、单行打印

    msg1 = '''sjijid = ddcd'''
    #单引号套双引号,双套单
    msg2 = "I'm lili"
    print(msg1,msg2)

     5、账号密码,输入框:

    一种:

    username = input("username:")
    password = input("password:")
    print(username,password)

     二种:

    name = input("name:")
    job = input("job:")

    info = '''
    ----- info of %s -------
    name:%s
    job:%s
    ''' % (name,name,job)
    print(info)

     #str转换成int
    age = int(input("age:"))

    #打印字符类型,把age转为字符串str(age)
    print(type(age),type(str(age)))

    
    
    #d:整数、f:小数
    age:%s
     
  • 相关阅读:
    设计模式的原则
    命令模式
    访问者模式
    策略模式
    外观模式
    组合模式
    原型模式
    合并有序数组
    判断二叉树是否对称
    中序遍历二叉树
  • 原文地址:https://www.cnblogs.com/liu1-/p/12795495.html
Copyright © 2011-2022 走看看