0

Help me please. Code the python using For loop to produce min,max,and average by list x=[16,50,22,49,15,64,58]

9th Nov 2020, 11:03 AM
Fariz Ghina
Fariz Ghina - avatar
3 Réponses
+ 1
Store the first element in a variable assuming it's max ,then create a for loop to iterate over the rest of elements in list not including first one . In for loop compare that max element with each element in list using less than equal to operator ,if it returns True simply assign current value (that you are comparing with) to max variable. Do same for min and for average ,sum the elements in for loop and then divide it by no.of elements
9th Nov 2020, 12:02 PM
Abhay
Abhay - avatar
0
Can you help me just write python code? please
9th Nov 2020, 12:20 PM
Fariz Ghina
Fariz Ghina - avatar
0
Fariz Ghina if you show what you have coded so far I can assist you, instead of writing code for you ,but from your statement it seems like even this sounds much difficult for you , if that's the case you can go through basics of python, https://www.sololearn.com/Course/Python/?ref=app If not ,I explained enough or provided a solution as a pusedocode to get you started with
9th Nov 2020, 1:33 PM
Abhay
Abhay - avatar