For this Question: Given a List of tuples as input, where the First Element is the Name and the second one, is the roll number in the tuple, your job is to sort the function on the Roll number using Python sorted function and lambda function.

eg: [('shalini', 35), ('Suri', 54), ('Aman', 56), ('Anu', 78)]In the first line, enter the number of entries you want to add
In the second line , enter the name and roll number with space separated

eg : 
2
Aman 32
Suri 41Print the sorted list of tuples 

eg: [('Suri', 41), ('Aman', 32)]Sample example:

Input:
3
Aman 21
Suri 3
darani 45

Output:
 [('Suri', 3), ('Aman', 21),('darani', 45)]
, I have written this Solution Code: def sort_second(pairs):
    sorted_pairs = sorted(pairs, key=lambda x: x[1])
    return sorted_pairs
    
n = int(input())
pairs = []
for i in range(n):
    ip = list(input().split())
    ip[1] = int(ip[1])
    ip = tuple(ip)
    pairs.append(ip)

print(sort_second(pairs)), In this Programming Language: Python, Now tell me if this Code is compilable or not?