From d8ad39d234ba9c04e1800d356f05950ddff4eeaf Mon Sep 17 00:00:00 2001 From: Kshitij Date: Mon, 11 Dec 2023 09:12:31 +0530 Subject: [PATCH] moved if temp>freq in highest frequency outside the inner loop, as it should be --- assignment-2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assignment-2.py b/assignment-2.py index 150cffb..272b90d 100644 --- a/assignment-2.py +++ b/assignment-2.py @@ -63,8 +63,8 @@ def high_freq(): for j in range(len(marks)): # Iterate through marks list using j again if (marks[i] == marks[j]): temp_count+=1 - if (freq_count < temp_count): # If temp_count is greater than freq_count value, then - freq_count = temp_count # Make freq_count equal to temp_count + if (freq_count < temp_count): # If temp_count is greater than freq_count value, then + freq_count = temp_count # Make freq_count equal to temp_count print(f"\n-----\nHighest frequency is:\t{freq_count}\n-----") def main():