fixed certain functions, simplified the code and added descrption for certain lines of code. [perfect code]
This commit is contained in:
parent
5e97a900f4
commit
9820343428
@ -28,14 +28,14 @@ def average_marks():
|
|||||||
if (i >= 0):
|
if (i >= 0):
|
||||||
marks_withoutAbsent.append(i)
|
marks_withoutAbsent.append(i)
|
||||||
else:
|
else:
|
||||||
break
|
continue
|
||||||
average_calc = sum(marks_withoutAbsent) / total
|
average_calc = sum(marks_withoutAbsent) / total
|
||||||
print(f"\n------\nAverage score of {total} students is:\t{average_calc}\n-----")
|
print(f"\n------\nAverage score of {total} students is:\t{average_calc}\n-----")
|
||||||
|
|
||||||
# Option 2 = High and low marks
|
# Option 2 = High and low marks
|
||||||
def high_low():
|
def high_low():
|
||||||
maxi = marks[0] # Initialize maxi with the first element of the marks list
|
maxi = marks[0] # Initialise maxi with the first element of the marks list
|
||||||
mini = marks[0] # Initialize mini with the first element of the marks list
|
mini = marks[0] # Initialise mini with the first element of the marks list
|
||||||
for i in range(len(marks)):
|
for i in range(len(marks)):
|
||||||
if (maxi < marks[i] and marks[i] > -1):
|
if (maxi < marks[i] and marks[i] > -1):
|
||||||
maxi = marks[i]
|
maxi = marks[i]
|
||||||
|
Loading…
Reference in New Issue
Block a user