0
anwser=str(input("Do you need a new phone? "))

if answer== "no":   
    print ("You are now finished. ")
else:    
    question1=str(input("Do you know what phone you want? ")
    if question1== "no":
        print("Research different phones and chose which pne you like best.")
    else:
        question2=str(input("Do you want to go on a contract? ")
        if question2== "no": 
             question3=str(input("Do you have enought money to pay full price for your phone? ")

What is wrong? How do I improve? It keeps coming up with a syntax error and I don not know why.

3
  • 3
    There are several missing parenthesis. You need foo = str(bar), not foo = str(bar. Commented Nov 8, 2015 at 15:55
  • Although the str is completely unnecessary anyway. Commented Nov 8, 2015 at 15:57
  • What does the syntax error tell you? Also, you should specify what version of Python, since syntax is slightly different between 2 and 3. Commented Nov 8, 2015 at 17:08

1 Answer 1

3

You're missing closing parentheses on your question lines:

question1 = str(input("Do you know what phone you want? ")

Should be:

question1 = str(input("Do you know what phone you want? "))

You also don't need to convert the input to a string, because input() already does that for you:

input([prompt])

If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that.

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

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.