1👍
✅
In your error statement
category_l1_array = list(set(deg_course_cat.objects.filter(degree_code=degree[i]).values_list('category_level1', flat=True)))
It is clear that variable degree doesn’t have any value at index i. That’s why it give Indexerror:list index out of range.
You can debug problem by using import pdb;pdb.set_trace() statement before error line.
Source:stackexchange.com