From 982034342825cf5c5b223ec1a2edad963cd7ac83 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Thu, 7 Dec 2023 16:19:16 +0530 Subject: [PATCH] fixed certain functions, simplified the code and added descrption for certain lines of code. [perfect code] --- assignment-2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assignment-2.py b/assignment-2.py index 9bea61a..150cffb 100644 --- a/assignment-2.py +++ b/assignment-2.py @@ -28,14 +28,14 @@ def average_marks(): if (i >= 0): marks_withoutAbsent.append(i) else: - break + continue average_calc = sum(marks_withoutAbsent) / total print(f"\n------\nAverage score of {total} students is:\t{average_calc}\n-----") # Option 2 = High and low marks def high_low(): - maxi = marks[0] # Initialize maxi with the first element of the marks list - mini = marks[0] # Initialize mini with the first element of the marks list + maxi = marks[0] # Initialise maxi 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)): if (maxi < marks[i] and marks[i] > -1): maxi = marks[i]