【发布时间】:2020-11-08 09:24:23
【问题描述】:
我需要编写一个程序,在表格中显示摄氏到华氏温度的转换。
问题 - 在列表中打印特定索引的正确方法是什么。 My attempt comes from the answer to a similar exercise outlined here。提前致谢。
这是我的代码
temp = range(0 , 101, 10)
tbl = []
tbl2 = []
for i in temp:
cel = i
tbl.append(cel)
fah = (i * 9/5) + 32
tbl2.append(fah)
print(cel, fah)
print('Celsius\t\tFahrenheit')
print('-------------------')
print(tbl(0) + ':\t\t', tbl2(0))
print('-------------------')
【问题讨论】:
-
print(str(tbl[0]) + ':\t\t', tbl2[0])
标签: python temperature