[Tutor] input problem ?

Walter van den Broek vdbroekw@wxs.nl
Thu, 06 Sep 2001 23:21:21 +0200


Hi, 
Complete newbie here.
>From a lot of patients we get data to obtain a diagnosis.
To make it easier and more accurate i planned to put the obtained scores
in a program to verify the diagnoses.
>From the first two questions at least one has to have a score>4.
If that is the case from the other 7 questions at least 4 have to score
higher than four to become diagnosed as being severely depressed.
I tried the following code to accomplish it, but became slightly
"depressed"
At first with the first two questions it worked well, appending the
other questions delivered error messages
Traceback (innermost last):
  File "<string>", line 1, in ?
SyntaxError: can't assign to operator (dsm4.py, line 10)
And this is the code:
import string
vraag_234 = input ( "Wat is de score bij vraag 234? ")
vraag_326 = input ("Wat is de score bij vraag 326? ")
vraag_317-321 = input ("Wat is de score bij vraag 317-321?")
vraag_272-315 = input ("Wat is de score bij vraag 272-315?")
vraag_334-343 = input ("Wat is de score bij vraag 334-343?")
vraag_315 = input ("Wat is de score bij vraag 315?")
vraag_240-242 = input ("Wat is de score bij vraag 240-242?")
vraag_325 = input ("Wat is de score bij vraag 325?")
vraag_246-250 = input ("Wat is de score bij vraag 246-250?")

if (vraag_234 > 4) or (vraag_326 > 4):
    print "Er kan sprake zijn van een depressie volgens DSM IV criteria"

else:
    print "Er kan geen sprake zijn van een depressie volgens DSM IV
criteria"



List = []
if (vraag_317-321 > 4):
    List.append
if (vraag_272-315 > 4):
    List.append
if  (vraag_334-343 > 4):
    List.append
if (vraag_315 > 4 ):
    List.append
if (vraag_240-242 > 4):
    List.append
if (vraag_325 > 4):
    List.append
if (vraag_246-250 > 4):
    List.append
len(List)
if len(List) > 4:
    print "Er is sprake van de depressieve stoornis volgens DSM IV
criteria"

else:
    print "Er is geen sprake van een depressieve stoornis volgens DSM IV
criteria"

    Is there to much input?, should i make functions?
>From the last 7 questions i decided to create a list of scores, append
was usede if the score was higher than 4, so if i have more then 4
positive results (scores higher than 4) the diagnoses is confirmed
Maybe  a difficult try out but to me it is very usefull if it works
Thanks, willing to learn
Walter
-- 
W.W. van den Broek	vandenbroek@psyd.azr.nl
URL: http://home.planet.nl/~vdbroekw
Private email: vdbroekw@wxs.nl