如何用PYTHON计算出什么时候100岁

 时间:2024-10-21 03:26:44

1、打开JUPYTER NOTEBOOK,新建一个空白PY文档。

如何用PYTHON计算出什么时候100岁

3、name = input("Please input your name: ")age = int(input("Please input your age: "))但是要注意岁数要用整型,因为做算法是不能用字符串的。

如何用PYTHON计算出什么时候100岁

5、name = input("Please input your name: ")age = int(input("Please input your age: "))age_100 = str((100 - age) + 2018)print("The year that you will trun 100 years old is " + age_100 + " .")定义一下类型就可以了。

如何用PYTHON计算出什么时候100岁

7、import datetimenow = datetime.datetime.now()name = input("Please input your name: ")age = int(input("Please input your age: "))age_100 = str(now.year + 100 - age)print("The year that {} will turn 100 years old is ". format(name) + age_100 + " ." )可以把程式修改得更完美一些。

如何用PYTHON计算出什么时候100岁
  • 如何理解总体国家安全观的科学内涵?
  • 海马体照相馆5个拍全家福的摄影技巧
  • 肾虚引起的白发怎么调养?
  • 自我完善的方向和方法
  • 考研题库如何开启夜间模式
  • 热门搜索
    庐山西海旅游攻略 鄂州旅游 青岛旅游网 武夷山旅游地图 去西双版纳旅游 丹巴旅游攻略 上海青青旅游世界 旅游广告语 龙脊梯田旅游 南京旅游路线