0

I have a list which is of type class people.

def class people:
name=""
age=0

class poeple has two data members name, age

I have a list of all person stating in the city as a list of objects of this class.list is called population

now i get an query to check if the person stays in the city.this is called queryperson

I used:
if(queryperson in population):
print( "person lives")
else:
print( "person does not live here")

However i always get person does not live here. Any clues on how to do this ?

Thank you for your help

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by jlm699
0

I used:
if (queryperson in population):

Print the list "population" and see what it contains.

0

Please use code tags. You will get more answers to your question if your post is friendlier to read. To do this, you simply place tags around your code like so:

[code=python] # This is where your code goes # In here between the code tags

[/code]

Doing this will give you pretty syntax highlighting and preserve your indentation. And your post won't look like a mess of text.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.