Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this portion of the lab design the solution in the following manner: Create

ID: 3701228 • Letter: F

Question

For this portion of the lab design the solution in the following manner:

Create a table using a two-dimensional array that stores a Fahrenheit temperate and the equivalent Celsius temperature. Use the following range of Fahrenheit temperatures

-10 through 100 in increments of 10, thus the temperatures will be

-10, 0, 10, 20, 30, 40, 50 …and so on

Display the contents of the list.

Similarly create tables/lists for the following (starting at 0 through 100 in increments of 10

Miles to kilometers

Gallons to liters

Pounds to kilograms

Inches to centimeters

Display the contents of each list

Save the program as firstname_lastname_Lab7a.py where you will replace firstname and lastname with your actual first and last name.

Explanation / Answer

Solution:

code:

def f2c(f):
   return (f-32)*5/9
def m2k(m):
   return 1.60934*m
def g2l(g):
   return 3.78541*g
def i2c(i):
   return 2.54*i
f2clist = [[] for i in range(12)]
print f2c(98.4)
x= -10.0
i=0
while(x<=100.0):
   f2clist[i]=[x,f2c(x)]
   x=x+10.0
   i=i+1
m2klist = [[] for i in range(11)]
i=0
x= 0.0
while(x<=100.0):
   m2klist[i]=[x,m2k(x)]
   x=x+10.0
   i=i+1

g2llist = [[] for i in range(11)]
i=0
x= 0.0
while(x<=100.0):
   g2llist[i]=[x,g2l(x)]
   x=x+10.0
   i=i+1

i2clist = [[] for i in range(11)]
i=0
x= 0.0
while(x<=100.0):
   i2clist[i]=[x,i2c(x)]
   x=x+10.0
   i=i+1
print "Fahrenheit to celsius conversions:"

for i in range(12):
   print f2clist[i]
print "miles to kilometers conversions:"

for i in range(11):
   print m2klist[i]
print "gallons to litres conversions:"

for i in range(11):
   print g2llist[i]
print "inches to centimeters conversions:"

for i in range(11):
   print i2clist[i]

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote