Function calling a name from a list, help me on... Its personal try, OFF the topics

print("Welcome to latters' family")
latters'_family = ["a", "b", "c", "d", "e", "f"]

### I want user to input the name, if the name is within the list of latters'_family, console should print out "You are the child os latters" else print ###
def latters'_family(name): ###I' not sure if its right on this###
    name = input("What is your name.?")
    if name == latters'_family():
        print("You are a child of latters")
    elif name != latters'_family():
        print("You are not a child of latters")`indent preformatted text by 4 spaces`

`indent pref`indent preformatted text by 4 spaces`ormatted text by 4 spaces`


Apostrophes might not be allowed in variable names

Lists are not callable, they are not functions. Perhaps see if the value exists in the list instead?

And if you're using Python2, then print is not a function and input should be avoided, use raw_input instead.
But if this is Python3, then you've got those things right.


Unless your intent was to create a recursive function I doubt you will be able to do anything with this function.

You can use list as a way to verify data or you can use a dict to pass a value into it check if it's there and return a value if there is a value associated.

From what I can see you are checking to see if something entered is a member of a group and you can easily do that by doing,

PYTHON CODE: Check if a member is valid part of a group

member_list = ['member_1', 'member_2', 'member_3']
def check_member_status(try_data):
    return True if try_data in member_list else False

Now, if your intent was to use a function based on input then I would use a dictionary. You can use a python dictionary as you would a Java switch.

PYTHON CODE: Java Switch in Python

def func_1(defl=1):
    return defl

def func_2(defl=2):
    return defl

def func_3(defl=3):
    return defl

func_switch = {
    'func_1': func_1,
    'func_2': func_2,
    'func_3': func_3

def use_switch(func_number):
    print(func_switch["func_%s" % func_number])

# You would then use it like

def get_input():
    return raw_input("Pick a number between 1 and %s" % len(func_switch))

# I enter 1

As you can see there are tons of things you can do, but as I said I am unsure of what you are trying to accomplish. If you need any more help feel free to ask.


Thanks for feedback, I'm using python 3.


thanks a lot zeziba, I'm still neonate at this stuff of coding( I'm at Unit 5 of Python)... My intention is to create a code where a user type a name, if his/her name exist in a list or so called dict, console should print out that is the member/ a child a i would like of that family... I'm trying to impress my family on what am learning and a way to motivate myself.


Ok, so what you want is totally doable, I have created a Github for your code, feel free to use the code as you like(Branch it for your use.). If you have any questions on it ask. There are several files just for readability and to make the code more efficient and compartmentalized.

I have also added a GUI for you to look at, if you have any questions ask, I will attempt to help you as best I can. This should be a good learning tool for you, with this you should be able to add all the different things that you want.

Family Matters (The Tree) Databases


Thanks again zeziba,.... all i see is bunch of code, let me check if can understand.



I updated program with more comments and hopefully better comments.

You can check it out here(Family Tree on Github)

If you have any questions about any part ask freely, also I used classes for most of it because you will need to get familiar with OOP-Object Orientated Programming if you wish to continue your path. Java is seriously OOP, python will let you program how you want be it functional, OOP or some other crazy way of doing things. Totally unlike Java.

Also SQLite is used because it is another programming language which is great to learn as almost every minor-major business uses it now-a-days.

Again, ask freely about any part, also I think I forgot to add the GNU-license, it means you can use any part without telling me. Just have to include the GNU.

Also, the .idea. file there is from my IDE so don't worry about that one unless you use jetbrains IDE.