0
swim_length =int(input("Please enter a swim length: "))

while swim_length < 0:
print("The length has to be a positive number")
swim_length=int(input("Please enter a positive number: ")

Hi could anyone help me with this, im sure i made a simple mistake but i can't figure out where exactly.

1
  • 1
    you're missing a ) at the end of last line Commented Nov 10, 2020 at 13:54

2 Answers 2

2

You have to add indentation to while loop and parentheses to the end of the last line:

swim_length =int(input("Please enter a swim length: "))

while swim_length < 0:
    print("The length has to be a positive number")
    swim_length=int(input("Please enter a positive number: "))
Sign up to request clarification or add additional context in comments.

Comments

0

first in the last line you are misssing an ending )

swim_length=int(input("Please enter a positive number: "))

also the body of the while loop needs to be indented

while swim_length < 0:
    print("The length has to be a positive number")
    swim_length=int(input("Please enter a positive number: ")

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.