Python培训
400-996-5531
题目:要求写一个程序,需要用户输入姓名和年龄,然后返回一个时间,告诉用户哪一年他会到85岁。
追加:输入需要追加发送消息的数量,然后打印
#!/usr/bin/python # -*- coding=utf-8 -*- import datetime ame = input('Please input your name: ') age = input('Please input your age: ') ow = datetime.datetime.now() year = now.yearage = int(age)year = year + 85 - age msg = 'Hi, {name}, by the year {year} you will be 85 years old'.format(name=name, year=year) print(msg) copies = input('Please input the number of copies you want the message to duplicate: ') copies = int(copies) msg = (msg+'\n') * copies print(msg)
免责声明:内容和图片源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。
填写下面表单即可预约申请免费试听! 怕学不会?助教全程陪读,随时解惑!担心就业?一地学习,可全国推荐就业!
Copyright © 京ICP备08000853号-56 京公网安备 11010802029508号 达内时代科技集团有限公司 版权所有
Tedu.cn All Rights Reserved