+ 2

Can somebody help me to tell how to add a second person in Python

I am currently trying to build a program which will allow specific people to enter to the program, but whenever I try to add the second person, the program accept everything that I input, without saying that that "person is the wrong person living in the house". Until the first person everything is fine, if I input the person`s correct name, it shows that the "person is the correct person in the house", and if I input a wrong person, it shows that the "person is the wrong person in the house", but whenever I try to add "or" and then the second person name, it give access to everybody, no matter whatever you are going to input. Below is the code, can somebody please help me with this issue? Thank you print("Welcome to your house climate control") print("Let`s begin") Name = input("What is your name? ") if Name == "Jack" or "Jacob" or "Ryan": print("You are the correct person living in this house") else: print("You are the wrong person living in this house")

5th May 2022, 2:00 PM
Danish Zubair
Danish Zubair - avatar
3 ответов
+ 6
Use like : if Name in [ "Jack", " Jocob", "Ryan"] :
5th May 2022, 2:24 PM
Jayakrishna 🇮🇳
+ 2
It worked, Thank you soo much
5th May 2022, 2:51 PM
Danish Zubair
Danish Zubair - avatar
+ 1
Thank you, I am going to try
5th May 2022, 2:28 PM
Danish Zubair
Danish Zubair - avatar