mercredi 23 décembre 2020

if else statement says " ',' or ')' expected"

PyCharm says "invalid syntax" in line 8 (the else) at the back of that line it says " ',' or ')' expected"

At the back of line 9 it says "Statement expected found Py:COLON" and "Statement expected found Py:ELSE_KEYWORD"

Here my code using Python 3.9:

distance = " " + input("Please enter the distance the body is supposed to travel here, if unknow leave empty:  ")
speed = " " + input("Please enter the velocity of the body here, if unkown leave empty: ")
time = 0

def get_Time():
    if(distance == " " and speed == " "):
        time = int(input("Please enter the time required for the body to cover the distance: ")
    else:
        time = int(distance)/int(speed)

Dont realy know what to do to fix this. I don't even understand the problem. Hope someone can help me.

Aucun commentaire:

Enregistrer un commentaire