You are given a list of courses that are currently available in BRACU that looks like the following: courses = ['CSE110','CSE111','MAT620','CS520','EEE361','CSE650','MAT5100','CSEE21','MAT3210']. All course code will have 3 digits with the department name of 3 letters. Any course code not following this rule is Invalid. Write a python program that creates a dictionary from the above list where the keys will be each department name (CSE,EEE,MAT for the above example) or Invalid. Departments will contain a list of valid courses for that department. Sample Input - No need to take input ['CSE110','CSE111','MAT620','CS520','EEE361','CSE650','MAT5100','CSEE21','MAT3210'] Sample Output : (You just need to print the resultatnt dictionary. No need to follow the format.) { 'CSE': ['CSE110','CSE111','CSE650'], 'EEE': ['EEE361'], 'MAT': ['MAT620'], 'Invalid': ['CS520','CSEE21','MAT5100','MAT3210'] }
You are given a list of courses that are currently available in BRACU that looks like the following: courses = ['CSE110','CSE111','MAT620','CS520','EEE361','CSE650','MAT5100','CSEE21','MAT3210']. All course code will have 3 digits with the department name of 3 letters. Any course code not following this rule is Invalid. Write a python program that creates a dictionary from the above list where the keys will be each department name (CSE,EEE,MAT for the above example) or Invalid. Departments will contain a list of valid courses for that department. Sample Input - No need to take input ['CSE110','CSE111','MAT620','CS520','EEE361','CSE650','MAT5100','CSEE21','MAT3210'] Sample Output : (You just need to print the resultatnt dictionary. No need to follow the format.) { 'CSE': ['CSE110','CSE111','CSE650'], 'EEE': ['EEE361'], 'MAT': ['MAT620'], 'Invalid': ['CS520','CSEE21','MAT5100','MAT3210'] }
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images