In this code if i input negetive numbers the code is not working | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

In this code if i input negetive numbers the code is not working

n = int(input()) result = {} all_marks = [] all_name =[] second_lowest = [] for i in range(n): name = input() scores = float(input()) result[name] = scores all_marks.append(scores) all_name.append(name) all_marks.sort() for i in range(0,n): if(all_marks [0+i]!= all_marks[0]): min = all_marks[0+i] if(all_marks [0+i+1]!= all_marks [0+i]): break val_list = list(result.values()) for i in range (n): if(min in val_list ): position = val_list.index(min) second_lowest.append (all_name[position]) val_list .pop(position) all_name.pop(position) second_lowest = second_lowest.sort() else: print(*second_lowest, sep = "\n")

22nd Dec 2021, 9:03 AM
Nisha
1 Antwort
+ 5
Nisha , it is very difficult to guess what your code is trying to do. without giving us a clear description including input and output samples, you will hardly find someone to help you. it's your turn now, good success!
22nd Dec 2021, 3:17 PM
Lothar
Lothar - avatar