i'm coding a function to my phyton3 program that get the weight of 7 people.
I don't know how i assign these 7 values to different variables, like:
a = 0
while(a < 7):
p = int(input("Seu peso"))
a = a + 1
And after that, he assign the different "p" values to different variables like, p1, p2, p3 ...
But with my level of "coding", i simply can't do that.
The general purpose of the program is:
And these 3 are why i have the need for different variables.
To get the weight of 7 people, you can do the following:
weights = [] #This is a list
for i in range(7): #This is a for loop
w = int(input("Seu peso "))
weights.append(w)
To say what weights are above 90kg:
for w in weights:
if w > 90:
print(w, "Is greater than 90kg")
To find the mean:
mean = sum(weights)/len(weights)
print("Mean Weight:", mean)