Main function will not run


#1

Please leave the following link in the post so we can find the unit module, else replace it with a link to the exact lesson:

Strings and Console Output

#Declare main module
def main():

    #declare variables
    age = 0
    weight = 0
    month = ()

    #introduction
    def introduction():
        print("Welcome to Guess the secrects! ")
        print("""I want you to guess the age, wieght, and birth month to
            uncover my secrects!""" )

    #ask user for input
    def get_age():
        age = input("Enter age. ")
        return age

    def get_weight():
        weight = input("Enter weight. ")
        return weight

    def get_month():
        month = input("Enter a birth month. ")
        return month

    def correct_answers():
        age = get_age
        weight = get_weight
        month = get_month

    # We will now determine if the user guess the correct answers
    #using if statements.
    def check_answers(age, weight, month):
        if age <= 25:
            print("Congratulations, the age is 25 or less. ")
        if weight >= 128:
            print("Congratulations, the weight is 128 or more. ")
        if month == "April":
            print("Congratulations, the birth month is April. ")
        else:
            print("Try again! ")

main()

#2

the main function runs fine, but the main method contains a lot of other functions which are never called.


#3

where do i call them?


#4

kind of confused that you nested all the other functions within the main function. Personally i would place the functions before the main function, and then all the function calls within the main function


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.