Python Program to Remove All Tuples in a List Outside the Given Range
y=[('a','12CS039'),('b','12CS320'),('c','12CS055'),('d','12CS100')]
low=int(input("Enter lower roll number (starting with 12CS):"))
up=int(input("Enter upper roll number (starting with 12CS):"))
l='12CS0'+str(low)
u='12CS'+str(up)
p=[x for x in y if x[1]>l and x[1]<u]
print(p)
Output
Enter lower roll number (starting with 12CS):50
Enter upper roll number (starting with 12CS):150
[('c', '12CS055'), ('d', '12CS100')]
