if···else
nian ji=31 if nian ji > 30: print('阿姨好')
nian ji=18 if nian ji > 30: print('阿姨好') else: print('小姐好')
nian ji=18 shen gao=171 ti zhong=99 is_pretty=True nian ji >= 18 and nian ji < 22 and shen gao > 170 and ti zhong < 100 and is_pretty == True: print('表白...')else: print('阿姨好')
if套if
nianji = 18
shengao = 171
tizhong = 99
is_pretty = True
cuowu = False
if nianji >= 18 and nianji < 22 and shengao > 170 and tizhong < 100 and is_pretty == True:
if cuowu:
print('表白...')
else:
print("去他妈的爱情")
else:
print('阿姨好')
while循环
jiji= 48
tag=True
while tag:
guess = int(input(">>我的鸡儿有多长:"))
if guess > jiji :
print("猜的太长了,往小里试试...")
elif guess < jiji :
print("猜的太小了,往长里试试...")
else:
print("恭喜你,猜对了...")