-
-
Save mayankdawar/4286b1351c87186c2821f26d098abb47 to your computer and use it in GitHub Desktop.
week_temps_f = "75.1,77.7,83.2,82.5,81.0,79.5,85.7" | |
temp_list = week_temps_f.split(',') #converting string into a list | |
lst=[float(i) for i in temp_list] #converting string values of list into float | |
avg_temp = sum(lst)/len(lst) #calculating average |
week_temps_f = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
avada = week_temps_f.split(',')
avg_temp1= 0
for i in avada:
avg_temp1= avg_temp1 +float(i)
avg_temp = avg_temp1 / float(7)
print (avg_temp)
week_temps_f = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
temps_lst = week_temps_f.split(',')
temps_sume= 0
num_temps = 0
for itr in temps_lst:
temps_sume= temps_sume +float(itr)
print(itr)
num_temps += 1
avg_temp = temps_sume / float(num_temps)
print (avg_temp)
week_temps_f = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
week_temps_f = week_temps_f.split(",")
accum = 0
for n in week_temps_f:
accum = accum + float(n)
avg_temp = accum/len(week_temps_f)
print(avg_temp)
week_temps_f = ("75.1,77.7,83.2,82.5,81.0,79.5,85.7").split(",")
print(week_temps_f)
s =len(week_temps_f)
avg_temp = 0
for z in week_temps_f:
avg_temp = (avg_temp + float(z))
total = avg_temp/s
print(total)
week_temps_f="75.1,77.7,83.2,82.5,81.0,79.5,85.7"
week_temps_f = week_temps_f.split(",")
d=0.00
e=0.00
for i in week_temps_f:
i=float(i)
d=d+1
e = e + i
avg_temp=0.00
avg_temp=(e/d)
print(avg_temp)
week_temps_f = "75.1,77.7,83.2,82.5,81.0,79.5,85.7"
sum = 0
count = 0
for temp in week_temps_f.split(","):
sum = sum + float(temp)
count = count + 1
avg_temp = sum/count
print(avg_temp)