0

Checking multiple items in List

So Iā€™m running my own list in idle with 4 names. I am able to use the in function to check a name but I am not sure how to have three print lines to check multiple names in my list. https://code.sololearn.com/c3dEU5AziL0r/?ref=app

5th Apr 2019, 9:11 PM
Justin
4 Answers
+ 2
Question doesn't seem to very clear. Do you mean you just want to print all those names from the list? If yes, then you can use for loop with a print() inside. If not then kindly provide the code snippet for same to get better help from the community.
6th Apr 2019, 1:17 AM
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½
ŠØŠ°Ń‰Šø Š Š°Š½Š¶Š°Š½ - avatar
+ 2
Save the code in a *.py file and open it with IDLE
6th Apr 2019, 9:37 AM
Anna
Anna - avatar
+ 1
names = list with names print(any(name in names for name in ('name1', 'name2', 'name3'))) Or: for name in ('name1', 'name2', 'name3'): if name in names: print(name)
6th Apr 2019, 5:43 AM
Anna
Anna - avatar
0
I didnt word the question that good. What im asking is extremly simple but I simply dont know how to do it. In the code I posted, there is a list. Underneath the list are three print lines checking values inside my list. When I run the code on idle, I only have the option to tab down and print one value. I want to know how to have 4 lines of code in total with three print prompts.
6th Apr 2019, 8:40 AM
Justin