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, 20.06.2019 18:04
You can use if your cursor is at the end of the word. use if you place the cursor on the left side of the word.
Answers: 2
question
Computers and Technology, 22.06.2019 20:30
In this lab, you complete a prewritten c program that calculates an employee’s productivity bonus and prints the employee’s name and bonus. bonuses are calculated based on an employee’s productivity score as shown below. a productivity score is calculated by first dividing an employee’s transactions dollar value by the number of transactions and then dividing the result by the number of shifts worked.
Answers: 3
question
Computers and Technology, 23.06.2019 11:30
Auser is given read permission to a file stored on an ntfs-formatted volume. the file is then copied to a folder on the same ntfs-formatted volume where the user has been given full control permission for that folder. when the user logs on to the computer holding the file and accesses its new location via a drive letter, what is the user's effective permission to the file? a. read b. full control c. no access d. modify e. none of the above
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. a company wants to use online methods to target more customers. it decides to conduct a market research by collecting the data of a few customers with their consent. they want to track data of the sites that their customers frequently visit. which software can the company? a. spyware b. bots c. adware d. trojan horse e. rootkits
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, 02.09.2020 04:01
question
Mathematics, 02.09.2020 04:01
question
History, 02.09.2020 04:01
question
History, 02.09.2020 04:01
Questions on the website: 13722361