yobdc 发表于 2021-8-25 13:52:46

python计算1年的秒数(2种方法)

DaysPerYear = 365
HoursPerDay = 24
MinutesPerHour = 60
SecondsPerMinute = 60
result = DaysPerYear * HoursPerDay * MinutesPerHour * SecondsPerMinute
print(result)

2.second = 1
minute = 60 * second
hour = 60 * minute
day = 24 *hour
year = 365 * day
print(year)

南归 发表于 2021-8-25 15:44:39

{:10_249:}那为何不直接print(60*60*24*365)

yobdc 发表于 2021-8-26 10:28:58

这来源于课后作业的那道题,要求使用变量,如果没要求,就可以这样直接打印
页: [1]
查看完整版本: python计算1年的秒数(2种方法)