Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with assignment
#5
Thanks :)

The problem is that the teacher has not yet gone through that variant and expects us to do it in the basic way

I tried to do it in this way, but it's says that "list index out of range".
Could you have helped me with that?

heating_data = [[50,15,25,10],[100,13,65,15],[25,32,67,80]]
for i in range (len(heating_data)):
m1 = heating_data[i][0]
t1 = heating_data[i][1]
t2 = heating_data[i][2]
s = heating_data[i][3]
C = 4.19
Q = m1*C*(t2-t1)
energy = Q*(2.7778*10**-7)
price = energy * s
print ([[m1,t1,t2,s,Q,energy,price]])
energi_cost = [[Q,energy,s],[Q,energy,s],[Q,energy,s]]
energi_cost = [i][0]
energi_cost = [i][1]
energi_cost = [i][2]
print(energi_cost)

round (energy,3)
round (price,2)
Reply


Messages In This Thread
Help with assignment - by dxfrelince - Feb-15-2019, 10:46 PM
RE: Help with assignment - by Larz60+ - Feb-16-2019, 12:35 AM
RE: Help with assignment - by dxfrelince - Feb-16-2019, 11:53 AM
RE: Help with assignment - by Larz60+ - Feb-16-2019, 12:38 PM
RE: Help with assignment - by dxfrelince - Feb-17-2019, 07:24 PM
RE: Help with assignment - by dxfrelince - Feb-18-2019, 11:56 AM
RE: Help with assignment - by perfringo - Feb-18-2019, 04:25 PM
RE: Help with assignment - by dxfrelince - Feb-18-2019, 09:16 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020