subject

Im trying to get my code to go through the If Loops multiple times, but it only goes through them the initial run. Does anyone what loop I should use to loop the if loops? here is my code:
import turtle as trtl
import random as rand

#import files (i=images, background, etc.)
patient_image = "patient. gif"
bloody_patient = "bloody patient. gif"
sick_patient = "Sick patient. gif"
#define variables here (endpoint of the patients, background dimensions)
screen_width = 400
screen_height = 400
patient_list = [patient_image, bloody_patient, sick_patient]
random_patient = rand. choice(patient_list)

#maybe for later use to put patients in line
'''front_line = (50 , 0)
second_line = (100 , 0)'''

'''current_patient = "." '''

wn = trtl. Screen()
wn. setup(width=.5, height=.5)
wn. tracer(False)
wn. addshape(patient_image)
wn. addshape(bloody_patient)
wn. addshape(sick_patient)

patient = trtl. Turtle()
patient. penup()
wn. tracer(False)

def draw_patient(patient, random_patient):
'''global random_patient'''
print ("inside draw patient " + random_patient)
'''random_patient = rand. choice(patient_list)'''
patient. penup()
patient. goto(400,0)
patient. shape(random_patient)
patient. showturtle()
wn. update()
print ("exiting draw patient")

def cure_patient():
wn. tracer(True)
random_patient = rand. choice(patient_list)
if (random_patient == patient_image):
print ("random patient = patient image")
if (random_patient == sick_patient):
print ("random patient = sick patient")
if (random_patient == bloody_patient):
print ("random patient = bloody patient")

print ("inside cure patient " + random_patient)
'''global random_patient'''

patient. goto(-100,-100)
patient. clear()
patient. hideturtle()
wn. tracer(False)
draw_patient(patient, random_patient)
print ("exiting cure patient")

print ("calling draw patient function")
draw_patient(patient, random_patient)
print ("finish draw patient function")

while

print ("if statement comparing random patient to patient")
if (random_patient == patient_image):
print ("inside if statement of patient image")
wn. onkeypress(cure_patient,"a")
print ("random patient = patient image / press the A key")

print ("if statement comparing random patient to sick patient")
if (random_patient == sick_patient):
print ("inside if statement of sick patient image")
wn. onkeypress(cure_patient,"s")

print ("random patient = sick patient / press the S key")

print ("if statement comparing random patient to bloody patient")
if (random_patient == bloody_patient):
print ("inside if statement of bloody patient image")
wn. onkeypress(cure_patient,"d")
print ("random patient = bloody patient / Press the D key")

print ("entering listen")
wn. listen()
print ("entering mainloop")
wn. mainloop()

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 22.06.2019 15:50
The file sales data.xlsx contains monthly sales amounts for 40 sales regions. write a sub that uses a for loop to color the interior of every other row (rows 3, 5, etc.) gray. color only the data area, columns a to m. (check the file colors in excel.xlsm to find a nice color of gray.)
Answers: 2
question
Computers and Technology, 23.06.2019 11:00
In the context of the box model, what is the difference between a margin and a padding? a. a padding lies outside a box border, while a margin lies inside it. b. a padding lies inside a box border, while a margin lies outside it. c. a padding can be adjusted independently, while a margin depends on the size of its box. d. a padding depends on the size of its box, while a margin can be adjusted independently.
Answers: 3
question
Computers and Technology, 24.06.2019 08:30
Why might you choose to create a functional resume
Answers: 1
You know the right answer?
Im trying to get my code to go through the If Loops multiple times, but it only goes through them th...
Questions
question
Mathematics, 19.06.2020 05:57
question
Mathematics, 19.06.2020 05:57
question
Mathematics, 19.06.2020 05:57
Questions on the website: 13722360