Parsons Problem

Using a for loop, transform the list of courses into a list of departments.

  1. In the space below, drag lines of code from the rows on the left to the empty rows on the right.
  2. Arrange the lines of code in the logical order that will produce the desired output.
  3. To indent a line of code, follow the yellow highlighting when positioning it over an empty row.
  4. To run your code, click the Run code button. The output of running your code, including any error messages, will appear in the panel at the bottom
  5. Click the Reset button to clear the code space on the right and start over.

Problem Setup

Assume that the following code has run already in this session.



courses = ['CHEM 1001 10', 'CHEM 1001 11', 'BISC 1111 10', 'BISC 2207 10', 'PSC 1001 10',

       'PSC 1001 11', 'PSC 1001 12', 'ANTH 3808 10', 'AMST 2071 80']

Compose your code here

depts.append(course_info[0])
for course in courses:
course_info = course.split()
print(depts)
depts = []

Python output

>>Python output here...