def find_max_and_min(records):
# Initialize variables
max_value = float('-inf')
min_value = float('inf')
max_record = None
min_record = None
# Iterate through the records
for record in records:
if record[1] > max_value:
max_value = record[1]
max_record = record
if record[1] < min_value:
min_value = record[1]
min_record = record
return max_record, min_record
# Example usage
kpop_records = {
'Group1': (2014, 100),
'Group2': (2015, 200),
'Group3': (2016, 150),
'Group4': (2017, 300),
'Group5': (2018, 250),
'Group6': (2019, 400),
'Group7': (2020, 350)
}
max_record, min_record = find_max_and_min(kpop_records.values())
print(f"The group with the maximum record is {max_record[0]} with {max_record[1]} records.")
print(f"The group with the minimum record is {min_record[0]} with {min_record[1]} records.")