# convert.py
# This program will convert a finite set of temperatures from Celsius to Fahrenheit
# starting from 0 to 90 increments of 10 deg C.
# The data is organized and printed using the Texttable module.
from texttable import Texttable
def main():
cList = []
fList = []
for i in range(0,100,10):
fahrenheit = 9/5 * i + 32
cList.append(i)
fList.append(fahrenheit)
t = Texttable()
for x in range(len(cList)):
t.add_rows([['Temperature Reading Index', 'Celsius','Fahrenheit'], [x, cList[x],fList[x]]])
print(t.draw())
if __name__ == "__main__":
main()
No comments:
Post a Comment