I left out the helper() function because it is gargantuan and is a problem for another day.Basically, this program asks for: Your nameYour parentsNumber of siblingsMarital statusNumber of spousesNumber of children for each spouseIt then dumps everything into a helper function which draws said family tree to a .txt file.The output is something like this:Grandfather  +  Grandmother             |             |--------------------       |         |          Daughter    Son + Daughter in-law                |                |      -----------------         |         |      Grandson Granddaughterwhere the variables and program starts from the son's point of view (his parents, his siblings, his children, his spouses).def create_family():    system(cls)    main_person = input(\nWho is the main person? He/She should \    have parents and children of their own: ).title()    father = input(\nWho is {0}'s father?: .format(main_person)).title()    mother = input(\nWho is {0}'s mother?: .format(main_person)).title()    x = True #Prevents program from shutting down immediately    while x is True:        try:            children_1 = int(input(\nHow many children do {0} and {1} have together\?: .format(father, mother)))            x = False        except ValueError:            print(\n\tPLEASE ENTER A VALID NUMBER!)              if children_1 < 1: #catch impossible answers        print(They cant have zero children!)        system(pause)        return    list_1 = [main_person,]    print(\nAlright. Now, please enter their names. Excluding {}!.format(main_person))    for i in range(children_1 -1): #Gen 2 has been entered        child_1 = input(\nMay I know their names?: ).title()        print(Thank you. {} was added to the list of children..format(child_1))        list_1.insert(0,child_1)      #---------------------------------------------------------------------------------------------------------------------#print(Debugging check 1: {} and {} have {} children, of which are {}.format(father,mother,children_1,clean_list_1))system(pause)system(cls)  #----------------------------------------------------------------------------------------------------------------------    marriage = input(Is {0} married?(y/n): .format(main_person)).lower()    if yes in marriage or y in marriage:        family = {} #wife: children, wife: children        list_2 = []        list_3 = [] #second wife's children        list_4 = [] #third wife's children        list_5 = [] #fourth wife's children        counter = 0        wife_counter = 1        y = True        while y is True:            try:                n_spouses = int(input(\nHow many spouses does {0} have?: .format(main_person)))                y = False            except ValueError:                print(\n\tPLEASE ENTER A VALID NUMBER!)        if n_spouses < 1: #catch impossible statements            print(You cant have 0 spouses! You said you were married!)                  system(pause)            return        for i in range(n_spouses): #for each wife, repeat if more than one wife.            if wife_counter == 1:                suffix = 1st            elif wife_counter == 2:                suffix = 2nd            elif wife_counter == 3:                suffix = 3rd            elif wife_counter == 4:                suffix = 4th            spouse_name = input(\n\tWhat is the {0} spouse's name?: .format(suffix)).title()            print(\n Thank you. {0} has been added as {1}'s spouse.format(spouse_name, main_person))            z = True            while z is True:                try:                    children_2 = int(input(\nHow many children do {0} and {1} have?\nEnter 0 if none!: .format(main_person, spouse_name)))                    z = False                except ValueError:                    print(\n\t PLEASE ENTER A VALID NUMBER)            if children_2 > 0: #if each wife got children                for i in range(children_2): #add the children to a list                    child_2 = input(\nMay I know their names?: ).title()                    print(child_2, has been added to {0} and {1}'s family!.format(main_person, spouse_name))                    if counter == 0: #First wife                        list_2.append(child_2)                    elif counter == 1: #Second wife                        list_3.append(child_2)                    elif counter == 2: #And so on...                        list_4.append(child_2)                    elif counter == 3:                        list_5.append(child_2)                if counter == 0: #Associate each wife to her children                    family[spouse_name] = list_2                elif counter == 1:                    family[spouse_name] = list_3                elif counter == 2:                    family[spouse_name] = list_4                elif counter == 3:                    family[spouse_name] = list_5                counter += 1 #to associate the first wife with her children, and the second with hers                wife_counter += 1 #to display correct 1st, 2nd or 3rd!            else:                helper(main_person, father, mother, list_1, family = False, wife_name = spouse_name)                  if children_2 > 0: # cant put it in the loop^            helper(main_person, father, mother, list_1, family = family, wife_name = spouse_name)        #print(Debugging check 2: {0} and {1} have {2} children. They are {3}.format(main_person, spouse_name, children_2, , .join(list_2)))    else:        helper(main_person, father, mother, list_1, family = False, wife_name = False)create_family()After reading, it seems that the general consensus is to break up that gargantuan create_family() function into smaller chunks of code as per the divide and conquer strategy. Below is the rewritten version of the above.def the_children(main_person, children_2, counter, family, list_2, list_3, list_4, list_5, spouse_name):    for i in range(children_2): #add the children to a list        child_2 = input(\nMay I know their names?: ).title()        print(child_2, has been added to {0} and {1}'s family!.format(main_person, spouse_name))        if counter == 0: #First wife            list_2.append(child_2)        elif counter == 1: #Second wife            list_3.append(child_2)        elif counter == 2: #And so on...            list_4.append(child_2)        elif counter == 3:            list_5.append(child_2)    if counter == 0: #Associate each wife to her children        family[spouse_name] = list_2    elif counter == 1:        family[spouse_name] = list_3    elif counter == 2:        family[spouse_name] = list_4    elif counter == 3:        family[spouse_name] = list_5def spouses(main_person, n_spouses,father, mother, list_1, wife_counter):    counter = -1    family = {} #wife: children, wife: children    list_2 = []    list_3 = [] #second wife's children    list_4 = [] #third wife's children    list_5 = [] #fourth wife's children    for i in range(n_spouses): #for each wife, repeat if more than one wife.        wife_counter += 1 #to display correct 1st, 2nd or 3rd!        counter += 1 #to associate the first wife with her children, and the second with hers        if wife_counter == 1:            suffix = 1st        elif wife_counter == 2:            suffix = 2nd        elif wife_counter == 3:            suffix = 3rd        elif wife_counter == 4:            suffix = 4th        spouse_name = input(\n\tWhat is the {0} spouse's name?: .format(suffix)).title()        print(\n Thank you. {0} has been added as {1}'s spouse.format(spouse_name, main_person))        z = True        while z is True:            try:                children_2 = int(input(\nHow many children do {0} and {1} have?\nEnter 0 if none!: .format(main_person, spouse_name)))                z = False            except ValueError:                print(\n\t PLEASE ENTER A VALID NUMBER)        if children_2 > 0:            the_children(main_person, children_2, counter, family, list_2, list_3, list_4, list_5, spouse_name)        else:            helper(main_person, father, mother, list_1, family = False, wife_name = spouse_name)                            helper(main_person, father, mother, list_1, family = family, wife_name = spouse_name)def married(main_person, father, mother, list_1):        system(cls)    marriage = input(Is {0} married?(y/n): .format(main_person)).lower()    if yes in marriage or y in marriage:        y = True        while y is True:            try:                n_spouses = int(input(\nHow many spouses does {0} have?: .format(main_person)))                y = False            except ValueError:                print(\n\tPLEASE ENTER A VALID NUMBER!)        if n_spouses < 1: #catch impossible statements            print(You cant have 0 spouses! You said you were married!)                  system(pause)            return        spouses(main_person, n_spouses, father, mother, list_1, wife_counter = 0)    else:        helper(main_person, father, mother, list_1, family = False, wife_name = False)def create_family():    system(cls)    main_person = input(\nWho is the main person? He/She should \have parents and children of their own.\nEg. Simon, Xavier,\Stephen, Jaya Mary \n\n\tperson: ).title()    father = input(\nWho is {0}'s father?: .format(main_person)).title()    mother = input(\nWho is {0}'s mother?: .format(main_person)).title()    x = True #Prevents program from shutting down immediately    while x is True:        try:            children_1 = int(input(\nHow many children do {0} and {1} have together\?: .format(father, mother)))            x = False        except ValueError:            print(\n\tPLEASE ENTER A VALID NUMBER!)              if children_1 < 1: #catch impossible answers (simon exists, they MUST have at least 1 children!)        print(They cant have zero children!)        system(pause)        return    list_1 = [main_person,]    print(\nAlright. Now, please enter their names. Excluding {}!.format(main_person))    for i in range(children_1 -1): #Gen 2 has been entered        child_1 = input(\nMay I know their names?: ).title()        print(Thank you. {} was added to the list of children..format(child_1))        list_1.insert(0,child_1)    married(main_person, father, mother, list_1)create_family()Which of the above two is more readable and recommended? I'm asking this because despite popular opinion, I still find them equally difficult to read and understand. Secondly, if anyone has any ideas to further refine the code, let me know.
Creates a tri-generational family tree (grandfather, mother, child)
python;python 3.x
The second version is better, but can still be improved. Part of the reason for breaking things into multiple functions, beyond just better organization, is to reduce code duplication, and there's room to do some more in that department.Input loopsFor example, you have a handful of similar input-entering and -validating loops. These could be abstracted into a generic input method:def int_prompt(prompt):    while True:        try:            return int(input(prompt))        except ValueError:            print(\n\tPLEASE ENTER A VALID NUMBER!)You won't need the x = True; while x flag if you just directly try to return.Lists instead of separate varsAnother slightly awkward part is the separate list_2, list_3, etc., and the if-elif chains to deal with them. You could simplify this by using one list of lists, so then you can index into it instead of using if statements:def the_children(main_person, children_2, counter, family, lists, spouse_name):    for i in range(children_2): #add the children to a list        child_2 = input(\nMay I know their names?: ).title()        print(child_2, has been added to {0} and {1}'s family!.format(main_person, spouse_name))        lists[counter].append(child_2)    # Associate each wife to her children    family[spouse_name] = lists[counter]But now it's clear that the_children() only ever modifies one of the lists per call (lists[counter]), so we could rewrite it to only take the relevant list, and forget about counter:def the_children(main_person, n_children, family, children_list, spouse_name):    for _ in range(n_children):        child = input(\nMay I know their names?: ).title()        print(child, has been added to {0} and {1}'s family!.format(main_person, spouse_name))        children_list.append(child)    family[spouse_name] = children_listActually, it looks like list_2 and co. are only used between spouses and children. It should be possible then for spouses to just pass the family dict into children to be modified, without any intermediate lists:def the_children(main_person, n_children, family, spouse_name):    family[spouse_name] = []    for _ in range(n_children):        child = input(\nMay I know their names?: ).title()        print(child, has been added to {0} and {1}'s family!.format(main_person, spouse_name))        family[spouse_name].append(child)def spouses(main_person, n_spouses, father, mother, list_1):    family = {}    # wife counter is just 1 .. n_spouses    for wife_counter in range(1, n_spouses + 1):        suffix = get_suffix(wife_counter)        spouse_name = input(\n\tWhat is the {0} spouse's name?; .format(suffix)).title()        print(\n Thank you. {0} has been added as {1}'s spouse.format(spouse_name, main_person))        n_children = int_prompt(\nHow many children do {0} and {1} have?\nEnter 0 if none!; .format(main_person, spouse_name))        if n_children > 0:            the_children(main_person, n_children, family, spouse_name)        else:            helper(main_person, father, mother, list_1, family=False, wife_name=spouse_name)    helper(main_person, father, mother, list_1, family=family, wife_name=spouse_name)Data modelFinally, as I'm sure you realize, genealogy can get pretty tangled. Your application may scale better (to more generations, etc.) if you had a more distinctly defined data model.Essentially this is a directed graph. Son to Grandfather is a Parent edge, Grandfather and Grandmother have a bidirectional Marriage edge, and so on. You could look at graph libraries like NetworkX -- although this is likely (definitely ;) overengineering if you'll only ever have three generations.