I am completely new to Python, and I need some help working with lists.
So here is a list:
Subjects=['SPLA100','SPLA107','SPLA219','INFO114','INFO128','INFO214']
I want to be able to let a user choose which classes to print out through input.
The user can choose to view the classes either by prefix(SPLA or INFO) or level(100 or 200) or both.
I've written this so far:
I know I have to use a nested for loop somehow, but I don't know how to use the input information to extract just the subjects that the user is asking for.
Can anyone help?
So here is a list:
Subjects=['SPLA100','SPLA107','SPLA219','INFO114','INFO128','INFO214']
I want to be able to let a user choose which classes to print out through input.
The user can choose to view the classes either by prefix(SPLA or INFO) or level(100 or 200) or both.
I've written this so far:
1 2 3 4 5 6 7 |
def choose: print ( 'Choose class (Press enter for all)' ) prefix = input ( 'Class: ' ) prefix = prefix.upper() level = input ( 'Level: ' ) for subject in Subjects: print (emne) |
Can anyone help?