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?
Aucun commentaire:
Enregistrer un commentaire