PythonStudy——格式化输入小练习

# 练习:用户输入姓名、年龄、工作、爱好 ,然后打印成以下格式
# ------------ info of Egon -----------
# Name : Egon
# Age : 22
# Sex : male
# Job : Teacher
# # ------------- end -----------------

 1 name = input("Please input your name :")
 2 age = input("Please input your age :")
 3 sex = input("Please input your sex :")
 4 job = input("Please input your job :")
 5 print("""------------ info of Egon -----------
 6 Name  : %s
 7 Age   : %s
 8 Sex   : %s
 9 Job   : %s
10 ------------- end -------------------""" %(name,age,sex,job))
View Code

猜你喜欢

转载自www.cnblogs.com/tingguoguoyo/p/10715160.html