I have something like 5 lists all containing different data.
I have the user input into a list like so:

for i in range (0,completed):
    print 'Class: ',
    course = raw_input()
    course = course.upper()
    allcourses.append(course)

now the list cmsc has as many courses in it as the user defined before the for loop.

Ok, thats fine, but now I have 3 different lists I need to compare the user list to. So if the user inputs 3 courses like:

cs 201
cs 202
math 151

Then I need it to print out the remaining courses in the lists. like

print 'you still need to take '
print remaining cs courses not appended in allcourses list
print remaining math courses not appended in allcourses list

Thanks in advance, this is just a personal project i really need, I always wonder what else I have to take o.O

Ok, in the mean time I have come up with the following code, btw this is my entire program.. so far

istrue = False

#main list where user taken courses will be stored
cmsc = []

#cs list for all cs courses
cs = ['CMSC 201','CMSC 202','CMSC 203','CMSC 304','CMSC 313','CMSC 331','CMSC 341','CMSC 345','CMSC 411','CMSC 421','CMSC 441']
cs.sort()

#math list for all math courses
math = ['MATH 151','MATH 152','MATH 221']

#stat list for all stat courses
stat = ['STAT 355']
stat =  ' '.join(stat).replace(","," ")

print "This program will determine what courses you need to take"
print "\n"

completed = input('How many courses in the CS program have you completed? ')

print 'Enter classes in the form <MAJOR-CODE> <COURSE-NUMBER>'
for i in range (0,completed):
    print 'Class: ',
    course = raw_input()
    course = course.upper()
    cmsc.append(course)
cmsc = ' '.join(cmsc).replace(","," ")

print 'Part A Requirements:'
for i in range (0,len(cmsc)):
    if cs[i] in cmsc:
        del(cs[i])
    i+=1
    print "You need to take: " + cs[i]

I'm getting list index out of range and I guess I know why, but theres I can't think of anyway to fix it. I'm getting correct output though.

Try something like this ...

cs = ['CMSC 201','CMSC 202','CMSC 203','CMSC 304','CMSC 313',
'CMSC 331','CMSC 341','CMSC 345','CMSC 411','CMSC 421','CMSC 441']

math = ['MATH 151','MATH 152','MATH 221']

stat = ['STAT 355']

required = cs + math + stat

# assume user entered this
cmsc = ['CMSC 201','CMSC 202','CMSC 203','MATH 151']

for item in required:
    if item not in cmsc:
        print "You still need to take: " + item
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.