我该如何编写可以使年龄变小时的程序

问题描述 投票:-1回答:2

我如何用python编写一个程序,它可以根据输入数据在数分钟和数小时内给我我的年龄,就像我在数年内给该程序以我的年龄,它将变成小时和分钟。

python
2个回答
0
投票
考虑转换并将其放入变量中:

years = int(input("How old are you? ")) days = years * 365.25 hours = days * 24 minutes = hours * 60 seconds = minutes * 60

然后,您可以输出这些变量。

0
投票
一年= 365 + 1/4天(6小时)= 6 x 60

一天= 24小时

一小时= 60分钟

一分钟= 60秒

因此,一年是365 x 24 = 8,760 + 6 = 8,766小时

8,766小时x 60 = 525,960分钟

525,960 x 60 =每年31,557,600秒

based on the user input, do the necessary calculation to convert it to hours/minutes in your program

© www.soinside.com 2019 - 2024. All rights reserved.