I'm running the following code:
if course_name.lower() in [x.split('.')[0].lower() for x in user_courses]:
do_code()
When the do_code() block runs, I know that course_name.lower() was matched in the list. Is there any way of getting the value of x in the list that course_name.lower() matched? As you can see, since I'm taking the [0] index when creating the list in
[x.split('.')[0].lower() for x in user_courses]
I want the entire value of user_courses that it matches, not just the zero indexed which is what course_name.lower() contains.
Thanks!