if语句用户交互字符串

字符串

字符串相加

a = "alex"
b = "wusir"
prin("a+b")

字符串相乘

a = "alex"
print(a*3)

用户交互

import getpass
name = input("请输入你的用户名:")
password = getpass.getpass("请输入你的密码:")			#只能在cmd中运行
print(password)      

if语句

if 3>2:
    print("yes")
if 3>1
	print("yes too")
a = int(input("输入一个数:"))
if a>2:
    print("hello")
else:
	print("hello world")
age =20
if age < 18:
    print("too young")
elif age < 30 and age >18:
	print("也不小了")
else:
	print("还能折腾几年啊")
if 50>0:
    print(666)
    if 20>0:
        print(6666)
        if 10>0:
            print(66666)
else:
    pass
posted @ 2019-07-02 20:16  ws997  阅读(194)  评论(0编辑  收藏  举报
8|0