name = input("name:")age = int(input("age:"))job = input("job:")salary = input("salary:") if salary.isdigit(): #长的像不像数字,比如200d。“200” salary = int(salary)# else:# #print("must input digit")# exit("must input digit")# 退出程序# msg = ‘‘‘------------info of %s-----------Name: %sAge : %dJob : %sSalary: %fYou will be retired in %s vears------------ end ---------------‘‘‘ % (name,name,age,job,salary,65-age)print(msg) # 字符串格式化输出# 占位符 %s s = string# %d d = digit 整数# %f f= float 浮点数,约等于小数。
原文地址:https://www.cnblogs.com/fy414371/p/9195077.html
时间: 2024-09-27 22:37:21