Python学习笔记(路飞学城听课整理)
格式化打印
name=input("name:")
age=input("age:")
job=input("job:")
hobbie=input("hobbie:")
msg=f'''
------------ info of Alex Li -----------
Name : {name}
Age : {age}
job : {job}
Hobbie: {hobbie}
------------- end -----------------
'''
print(msg)
多分支
score = int(input("Score:"))
if score > 89:
print("A")
elif score > 79:
print("B")
elif score > 59:
print("C")
elif score > 39:
print("D")
else:
print("E")
循环
猜年龄
需求: 最多允许猜三次,猜对了就退出程序
real_age = 21
for i in range(3):
guess_age = int(input("guess a number:"))
if guess_age &g