## 代码实现
下面是Python3代码实现:
total_seconds = 1234
minutes = total_seconds // 60
seconds = total_seconds % 60
print("1234秒相当于{}分{}秒".format(minutes, seconds))
## 运行结果
运行上面的代码,输出结果为:
1234秒相当于20分34秒
因此,1234秒相当于20分34秒。
这个是 python2.7 的代码,如果是 python3.x 的话,改一下 print 函数就好。
if __name__ == '__main__':list_three = []
list_six = []
list_nine = []
for i in range(1, 301):
if i % 3 贺芹则== 0 or str(i).find('3') <> -1:
list_three.append(i)
if i % 6 == 0 or str(i).find('6') <> -1:
list_six.append(i)
if i % 9 == 0 or str(i).find('9') <> -1:
首迟 list_nine.append(i)
print '3 output: '
for item in list_three:
print item,
print ''
print '6 output: '
for item in list_six:
print item,
print ''
print '9 output: '
for item in list_nine:
print 禅棚item,
print '
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)