0

Hello everyone im new here and new to python. Im working on some Python exercises I found online and am stuck on what I am doing wrong. Im trying to learn and teach myself about if and else statements. Here is my code.

weight = (float(input("How much does your suitcase weigh? "))
if weight > 50:
          print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your buisness. ")

input()

I am getting an invalid syntax error after 50: and not sure why. Can anyone briefly explain what im doing wrong?

Thank you for your time.

3 Answers 3

2

On your first line, you're missing an end parentheses.

weight = (float(input("How much doees your suitcase weigh? ")))
if weight > 50 :
     print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your buisness. ")

input()
Sign up to request clarification or add additional context in comments.

3 Comments

Well that makes sense. That works and I understand where I messed up. Thank you!
@Matticus A tip: if you're getting an error on a line that looks fine, it usually means you missed a parenthesis on the line above. And accept this answer if it solved your problem.
Thanks for the tip, and whoops didn't realize thats what the Check was for.
1

The solution is correct...and you actually have extra parentheses.

This code also works:

weight = float(input("How much does your suitcase weigh? "))

if weight > 50:
    print("There is a $25 fee for a luggage that heavy.")

print("Thank you for your business")

Comments

0

in any programming language you need to know about what you opened/closed parentheses.

weight = (float(input( 

now you have three ( ( ( so at the end you need three parentheses too

weigh? ")))

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.