PythonStudy——格式化输入小练习

论坛 期权论坛 脚本     
匿名技术用户   2021-1-14 14:39   220   0
# 练习:用户输入姓名、年龄、工作、爱好 ,然后打印成以下格式
# ------------ 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

转载于:https://www.cnblogs.com/tingguoguoyo/p/10715160.html

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP