# write a program to read the scores of n players and display total score,min score # max score(max,min score expltn needed) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

# write a program to read the scores of n players and display total score,min score # max score(max,min score expltn needed)

n=int(input("Enter how many players?")) # 5 scores=[] for i in range(n): # 0 1 2 3 4 score=int(input("Enter score")) scores.append(score) print(f'Scores are {scores}') total=0 for s in scores: total=total+s print(f'Total score is {total}') maxscore=0 minscore=0 for s in scores: if s>maxscore: maxscore=s print(f'maximum score {maxscore}') for i in range(n): # 0 1 2 3 4 if i==0: minscore=scores[0] elif scores[i]<minscore: minscore=scores[i] print(f'minimum score {minscore}')

29th Jan 2022, 3:00 PM
NAVEEN VYAS
7 Answers
+ 1
Check in your code, from for i in range(5) : print(i, scores[i] ) # i used for index # scores[I] represents values
29th Jan 2022, 5:41 PM
Jayakrishna 🇮🇳
+ 1
I need minimum score explaination can any one
29th Jan 2022, 3:12 PM
NAVEEN VYAS
+ 1
First it set minscore = scores[0] And any other value are tested minscore<scores[I] , if yes then update minscore[I] Else continue Ex:: 3 4 5 2 7 Min=3 for i in range(5) : I = 0 => setting min=3 Next I= 1 => 4<3 false I= 2 => 5<3 false I= 3 => 2<3 true so set min=2 I= 4 => 7<2 false So min=2 May you have doubt, why not min=0 at initially, if yes then for all inputs expect for negative values min<scores[0] is false so minscore value remain 0 after loop. But input have no value 0. hope it helps..
29th Jan 2022, 3:27 PM
Jayakrishna 🇮🇳
+ 1
It's more helpful brother❤️❤️
29th Jan 2022, 4:54 PM
NAVEEN VYAS
+ 1
I understood everything,in my solution, in if statment why I==0, is it index or just considered score. As zero initial,little confused
29th Jan 2022, 4:55 PM
NAVEEN VYAS
+ 1
TQ you for helping
29th Jan 2022, 6:00 PM
NAVEEN VYAS
0
Okkk got it❤️❤️❤️❤️❤️
29th Jan 2022, 6:00 PM
NAVEEN VYAS