0

I keep getting

SyntaxError: invalid syntax on line 10 (else statement)

I've checked my code over and over but I haven't found what's wrong with it. Help me.

def phoneCall(min1, min2_10, min11, s):
    minutes = 0 
    costs = [min1, min2_10, min11]
    for i in costs:
        if s > 0:
            if i == min1:
                minutes += 1
            elif i == min2_10:
                minutes += ((s//(min2_10 * 9)) * min2_10
            else:
                minutes += s/min11
    return minutes   

1 Answer 1

4

Your use of the else is correct, however you are missing the closing parenthesis ()) after you elif

You can either remove the opening one

minutes += (s//(min2_10 * 9)) * min2_10

Or add a closing one

  • minutes += ((s//(min2_10 * 9)) * min2_10)
  • minutes += ((s//(min2_10 * 9))) * min2_10
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.