+ 1
Average program python?
I'm trying to create a program that takes numbers as input in the range that comes also from input and outputs the average but I have problems with the for loop. Some advice?
2 Réponses
+ 1
when you create a range you are working with it like you would with a list.
for does something as for every value in your list, tuple, range, ...
for value in range(3):
print(value)
is the same as...
x = range(3)
print(x[0])
print(x[1])
print(x[2])
0
Wrote a script with a couple of possible answers here:
https://code.sololearn.com/cdeXj3pXFnxv/#py
Please upvote if it's helpful!