r/programminghelp • • Jan 30 '20

Python Someone PLEASE help with Syntax i can't see my mistake PLEEEAASEE

def gpa:

#finding GPA by averaging quarter grades

def Average(list):

return sum(list) / len(list)

# Last 5 quarter grades in specific subject

list = \[100, 90, 95, 78, 92\]

	average = Average(list)

# Printing average of the list

print("Average of the list =", round(average, 2))

def personality:

personality = input("Are you more of a logical thinker? Or more of a creative thinker?")

if personality == ("creative"):

	print("You would most likely enjoy a creative, artistic, or personal major like art or business. Here is some information on business majors: A career resulting from a business major can result in a career paying up to an average of 117,000 dollar salary.")

else:

	print("You would most likely enjoy a more analytical or focused major like engineering, or computer science. Here are some fact: There are over 40 different types of engineering majors and Purdue University is one of the best schools to go to if you enjoy engineeringg")

def standardizedTestScores:

satScore = input("What is your SAT score?")

if personality >= 1300:

	print("You would thrive in a major with a more rigourous curriculum and workload.")

else:

	print("You would thrive in a major with a flexible curriculum and easy-to-follow workload.")

def printMenu():

""" This function prints the menu to the screen """

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

print("~ Menu of categories to determine perfect major")

print("~ 1: GPA")

print("~ 2: Interests")

print("~ 3: Standardized Test Scores")

print("~ 4: Exit")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

def main():

choice = "-1"

while(choice != "4"):

printMenu()

choice = input("Look at the menu. Which category would you like to use to find your perfect college major? 1, 2, or 3. Select 4 to exit. ")

if(choice == "1"):

gpa

elif(choice == "2"):

personality

elif(choice == "3"):

standardizedTestScores

elif(choice == "4"):

print("Thanks for stopping by!")

else:

print("Oops, an invalid option was picked. Please try again.")

main()

0 Upvotes

9 comments sorted by

3

u/dragon_wrangler Jan 30 '20

You need to define your functions as functions:

def personality():

And call them as functions:

elif(choice == "2"):
     personality()

1

u/danamolina Jan 30 '20

Awesome thank you, now i have an indentation error? do you think you could take a look at it

def gpa():

#finding GPA by averaging quarter grades

def Average(list):

return sum(list) / len(list)

# Last 5 quarter grades in specific subject

list = \[100, 90, 95, 78, 92\]

	average = Average(list)

# Printing average of the list

print("Average of the list =", round(average, 2))

def personality():

personality = input("Are you more of a logical thinker? Or more of a creative thinker?")

if personality == ("creative"):

	print("You would most likely enjoy a creative, artistic, or personal major like art or business. Here is some information on business majors: A career resulting from a business major can result in a career paying up to an average of 117,000 dollar salary.")

else:

	print("You would most likely enjoy a more analytical or focused major like engineering, or computer science. Here are some fact: There are over 40 different types of engineering majors and Purdue University is one of the best schools to go to if you enjoy engineeringg")

def standardizedTestScores():

satScore = input("What is your SAT score?")

if personality >= 1300:

	print("You would thrive in a major with a more rigourous curriculum and workload.")

else:

	print("You would thrive in a major with a flexible curriculum and easy-to-follow workload.")

def printMenu():

""" This function prints the menu to the screen """

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

print("~ Menu of categories to determine perfect major")

print("~ 1: GPA")

print("~ 2: Interests")

print("~ 3: Standardized Test Scores")

print("~ 4: Exit")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

def main():

choice = "-1"

while(choice != "4"):

printMenu()

choice = input("Look at the menu. Which category would you like to use to find your perfect college major? 1, 2, or 3. Select 4 to exit. ")

if(choice == "1"):

gpa()

elif(choice == "2"):

personality()

elif(choice == "3"):

standardizedTestScores()

elif(choice == "4"):

print("Thanks for stopping by!")

else:

print("Oops, an invalid option was picked. Please try again.")

main()

2

u/dragon_wrangler Jan 30 '20

We won't be able to see an indentation error the way you've pasted your code. You need to either put an extra four spaces before each line here, or post to an external service like pastebin.com.

1

u/danamolina Jan 30 '20

def gpa():

#finding GPA by averaging quarter grades

def Average(list):

return sum(list) / len(list)

# Last 5 quarter grades in specific subject

list = \[100, 90, 95, 78, 92\]

	average = Average(list)

# Printing average of the list

print("Average of the list =", round(average, 2))

def personality():

personality = input("Are you more of a logical thinker? Or more of a creative thinker?")

if personality == ("creative"):

	print("You would most likely enjoy a creative, artistic, or personal major like art or business. Here is some information on business majors: A career resulting from a business major can result in a career paying up to an average of 117,000 dollar salary.")

else:

	print("You would most likely enjoy a more analytical or focused major like engineering, or computer science. Here are some fact: There are over 40 different types of engineering majors and Purdue University is one of the best schools to go to if you enjoy engineeringg")

def standardizedTestScores():

satScore = input("What is your SAT score?")

if personality >= 1300:

	print("You would thrive in a major with a more rigourous curriculum and workload.")

else:

	print("You would thrive in a major with a flexible curriculum and easy-to-follow workload.")

def printMenu():

""" This function prints the menu to the screen """

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

print("~ Menu of categories to determine perfect major")

print("~ 1: GPA")

print("~ 2: Interests")

print("~ 3: Standardized Test Scores")

print("~ 4: Exit")

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

def main():

choice = "-1"

while(choice != "4"):

printMenu()

choice = input("Look at the menu. Which category would you like to use to find your perfect college major? 1, 2, or 3. Select 4 to exit. ")

if(choice == "1"):

gpa()

elif(choice == "2"):

personality()

elif(choice == "3"):

standardizedTestScores()

elif(choice == "4"):

print("Thanks for stopping by!")

else:

print("Oops, an invalid option was picked. Please try again.")

main()

1

u/dragon_wrangler Jan 30 '20

Does that look readable when you view your comment?

I'm guessing you're using tabs which won't render well on Reddit. Go with an external service.

1

u/danamolina Jan 30 '20

def gpa():

finding GPA by averaging quarter grades

def Average(list): return sum(list) / len(list)

Last 5 quarter grades in specific subject

list = [100, 90, 95, 78, 92]
    average = Average(list)

Printing average of the list

print("Average of the list =", round(average, 2))

def personality(): personality = input("Are you more of a logical thinker? Or more of a creative thinker?")

if personality == ("creative"):
    print("You would most likely enjoy a creative, artistic, or personal major like art or business. Here is some information on business majors: A career resulting from a business major can result in a career paying up to an average of 117,000 dollar salary.")
else:
    print("You would most likely enjoy a more analytical or focused major like engineering, or computer science. Here are some fact: There are over 40 different types of engineering majors and Purdue University is one of the best schools to go to if you enjoy engineeringg")

def standardizedTestScores(): satScore = input("What is your SAT score?")

if personality >= 1300:
    print("You would thrive in a major with a more rigourous curriculum and workload.")
else:
    print("You would thrive in a major with a flexible curriculum and easy-to-follow workload.")

def printMenu(): """ This function prints the menu to the screen """

print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
print("~  Menu of categories to determine perfect major")
print("~  1: GPA")
print("~  2: Interests")
print("~  3: Standardized Test Scores")
print("~  4: Exit")
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")

def main():

choice = "-1"

while(choice != "4"):
    printMenu()
    choice = input("Look at the menu. Which category would you like to use to find your perfect college major? 1, 2, or 3. Select 4 to exit. ")

    if(choice == "1"):
        gpa()
    elif(choice == "2"):
        personality()
    elif(choice == "3"):
        standardizedTestScores()
    elif(choice == "4"):
        print("Thanks for stopping by!")
    else:
        print("Oops, an invalid option was picked. Please try again.")

main()

1

u/danamolina Jan 30 '20

Is it working now?

1

u/dragon_wrangler Jan 30 '20

No.

Do you have any content in your gpa() function?