我正在为一个介绍python类做作业,不知道如何使用我的出生日期和当前日期计算年龄。在
print("Hello, welcome to Hopper's Computer Museum! To determine your entrance fee, please enter the following:")
dob = int(input("Your Date of Birth (mm dd yyyy)-: "))
currentdate = int(input("Today's date (mm dd yyyy): "))
任何帮助从哪里开始从我已经有代码将是美妙的。我不知道如何使用输入mm-dd-yyyy来计算年龄。在
为什么不简单地用当前日期减去出生年份呢?你会知道你活了多少年。如果你想准确地知道它,那么减去月份和日期。在
相关问题 更多 >
编程相关推荐