Keep the rows that match · in code: Filtering a List
Makes a new list of only the rows (or items) that match a condition, like the students who scored above 80.
row.marks > 80.row.dept == "CSE".m >= 50.students.row. It's only used there.row.marks > 80.toppers. The list it came from stays as it was.Open it in the editor, press Run, then change it and run it again.
marks = [45, 80, 62, 30, 91]"Passed: " + join(passed)Passed: 80, 62, 91marks = [45, 80, 62, 30, 91]passed = []for m in marks: if m >= 50: passed.append(m)print("Passed: " + ", ".join(str(item) for item in passed))