0

Help me !!!!

Can anyone give me a layout of code of sum and AVG of multiples of 5 btw 500 to 600 in python only

17th May 2021, 12:07 PM
Disha Jain
5 odpowiedzi
+ 2
#(Or) sum=0 count=1 for i in range(500,600,5): # 5 here means steps by 5 each iteration by default this is 1 in a for loop print(i, end=' ') sum=sum+i count=count*i print() print(sum) print(count) avg=(sum+count)//2 print(avg)
17th May 2021, 12:20 PM
minirkk
minirkk - avatar
+ 1
sum=0 count=1 # need to a value of 1 because any number multiply 0 would be 0 for i in range(500,600): if i%5 == 0: # if i is divisible by 5 that's means it's multiple of 5 print(i, end=' ') sum=sum+i count=count*i print() print(sum) print(count) avg=(sum+count)//2 print(avg)
17th May 2021, 12:18 PM
minirkk
minirkk - avatar
+ 1
Thanks rkk
17th May 2021, 12:23 PM
Disha Jain
0
Sum=0 Count=0 for I in range (500,600): I=I+5 Sum=sum+I Count=count+I print(sum) print(count) AVG=sum//count print(AVG)
17th May 2021, 12:09 PM
Disha Jain
0
This is my code.....but I know... its totally wrong.....pls anyone can give me the right code
17th May 2021, 12:10 PM
Disha Jain