0
knowledge = input().lower()

if knowledge in list1:
    m = float(input())

if knowledge in list2:
    g = float(input())

if knowledge in list3:
    Fz = float(input())

if knowledge in list4:
    W = float(input()

if knowledge in list5:
    F = float(input()

if knowledge in list6:
    Δx = float(input()

List 1 to 6 are all defined in another part of the code, for example: list1 = "m", "mass", "kg"

From the if statement of list 4 (including the if statement from list 4 and further ones), I get an invalid syntax, which points to the ":" at the end of the if statement of list 4.

When removing the if statement of list 4, it will point to the ":" of list 5, and so onward.

What is happening here, and how do I fix it? Is it cause of my big amount of if statements?

1
  • 1
    Check your parentheses (and consider using variable names people can actually type). Commented Nov 25, 2015 at 22:24

1 Answer 1

5

You have unclosed float() parenthesis:

knowledge = input().lower()

if knowledge in list1:
    m = float(input())

if knowledge in list2:
    g = float(input())

if knowledge in list3:
    Fz = float(input())

if knowledge in list4:
    W = float(input())

if knowledge in list5:
    F = float(input())

if knowledge in list6:
    delta_x = float(input())
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.