What is wrong with my Python 3.4.1 (last version) code?
Question: I was trying to do this code ... but I don't where's the problem.

I need do a program makes a person to 5 questions about the crime. The
questions are:

  * Telephoned the victim? 
  * Was on the scene? 
  * Lives near the victim? 
  * Should(must) for the victim? 
  * Worked with the victim? 

The program should in the end issue a rating about the participation of the
person in the crime.If the person to respond positively to two questions she
should be classified as "suspicious", between 3 and 4 as "accomplice" and 5 as
"Killer". Otherwise, it will be classified as "Innocent".

I did... like this....

    
    
    questions = float(input("answer yes or no : "))
    
    questions = 
        print("Telephoned the victim? "),
        print("Was on the scene?  "),
        print ("Lives near the victim?"),
        print("Should(must) for the victim? "),
        print("Worked with the victim? "),``
        ]
    
    for question in question:
        r = raw_input(question)
        if r.upper() != 'S' and r.upper() != 'N':
            print ("the answer maybe is Y for Yes or  N for No")
            print ("start again")
            exit()
        else:
            answer.append(r.upper())
    
    qntd_yes = answers.count('S')
    
    if qntd_yes == 2:
        print ('Suspicious')
    elif 3 <= qntd_yes <= 4:
        print ('accomplice')
    elif qntd_yes == 5:
        print ('killer')
    else:
        print ('Inocent')
    

Here is my error:

    
    
    Traceback (most recent call last):
      File "/usr/lib/python3.2/py_compile.py", line 119, in compile
        optimize=optimize)
      File "./prog.py", line 3
        questions = 
                   ^
    SyntaxError: invalid syntax
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.2/py_compile.py", line 123, in compile
        raise py_exc
    py_compile.PyCompileError:   File "./prog.py", line 3
        questions =
                   ^
    SyntaxError: invalid syntax
    

(Of the line 1 at 30 is my code)

I think is possible to do more easy, but I can't do ... I try and try but I
can not run it ... If someone can help me I will be very happy.


Answer: Your code is full of syntax errors. Here is what I think might work, I'll need
more information to help any further.

    
    
    import sys
    
    questions = [
        "Telephoned the victim? ",
        "Was on the scene?  ",
        "Lives near the victim?",
        "Should(must) for the victim? ",
        "Worked with the victim? "
        ]
    
    answers = []
    for question in questions:
        r = input(question)
        if r.upper() != 'Y' and r.upper() != 'N':
            print ("the answer maybe is Y for Yes or  N for No")
            print ("start again")
            sys.exit(1)
        else:
            answers.append(r.upper())
    
    qntd_yes = answers.count('Y')
    
    if qntd_yes == 2:
        print ('Suspicious')
    elif qntd_yes == 3 or qntd_yes == 4:
        print ('Accomplice')
    elif qntd_yes == 5:
        print ('Killer')
    else:
        print ('Innocent')
    

I'm not sure what you're getting at in the comments, but if you don't want to
use `sys.exit` or `r.upper` you can do this.

    
    
    questions = [
        "Telephoned the victim? ",
        "Was on the scene?  ",
        "Lives near the victim?",
        "Should(must) for the victim? ",
        "Worked with the victim? "
        ]
    
    
    
      main() :
        answers = []
        for question in questions:
            r = input(question)
            if r != 'Y' and r != 'y' and r != 'N' and r != 'n':
                print ("the answer maybe is Y for Yes or  N for No")
                print ("start again")
                return 1
            else:
                answers.append(r.upper())
    
        qntd_yes = answers.count('Y')
    
        if qntd_yes == 2:
            print ('Suspicious')
        elif qntd_yes == 3 or qntd_yes == 4:
            print ('Accomplice')
        elif qntd_yes == 5:
            print ('Killer')
        else:
            print ('Innocent')
        return 0
    
    if __name__ == '__main__':
        main()
    

Note: you can also just check `r` against `Y` and `N` if you only want the
user to be able to input capitals, or visa-versa for lower case.

