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
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)
+ 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)
+ 1
Thanks rkk
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)
0
This is my code.....but I know... its totally wrong.....pls anyone can give me the right code