What's wrong with this code?
ss=int(input("Enter the number of secret codes:")) for i in range(ss): sn=input("Enter the name of code:") nos=int(input("Enter number of codenames:")) print("Enter the details of the codes in the following format:Codename,Code1|Code2:") d2 = dict(input().split('|') for i in range(nos)) print(d2) key_list = list(d2.keys()) val_list = list(d2.values()) val_list = [int(i) for i in val_list] maxm = val_list[0] for x in val_list: if x > max : max = x # print key with val position = val_list.index(x) print("The code2 with the highest value obtained as per the given details:",x) print("The details of the code in",sn,"is:") pin=key_list[position].split(",") print("Codename:",pin[0]) print("Code1:",pin[1]) It doesn't work when I put values like: rrf,99|87 ggo,101|76 It doesn't print the maximum value i.e rrf but prints ggo instead. Is there anything wrong with this code? Please let me know