when the user hits enter it will display Price must be a valid positive number

product_price=input("Please enter product price:")
while product_price <=0 or product_price=="":
print"Price must be a valid positive number"
product_price=input("Enter product price:")

but it get the following error when the user hits enter
SyntaxError: unexpected EOF while parsing

Recommended Answers

All 2 Replies

You'll have to post the entire error message and state what version of Python you are running for us to help there. However, the statement
while product_price <=0 or product_price=="":
first assumes product_price is an integer, "<=0", and second assumes it is a string,product_price=="". You have to choose one or the other.

Member Avatar for Enalicho

You're using input() in Python 2.x, which is something you should _never_ do. Use raw_input instead, and read what woooee suggested.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.