samedi 20 janvier 2018

Python else if statement invalid syntex error

I am working on a program to calculate one of three types of averages. The code initially worked until I called the Geometric function. Now I'm getting an invalid syntex error on the else statement.

a = int(input("Please enter an integer:"))
b = int(input("Please enter a second integer:"))
option = (input('Please choose your desired type of average \n 
Arithmetic, Geometric, or Root-mean-square: '))

def means(option): 
    if option == 'Arithmetic':
        return((a+b)/2)
    elif option == 'Geometric':
        return(sqrt(ab))
    else option == 'Root-mean-square':
        return(sqrt((a+b)/2))

print(means(option))

Aucun commentaire:

Enregistrer un commentaire