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 22:50
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 23.06.2019 03:10
Fill in the following program so that it will correctly calculate the price of the orange juice the user is buying based on the buy one get one sale.#include //main functionint main() { int cartons; float price, total; //prompt user for input information printf("what is the cost of one container of oj in dollars? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & price); printf("how many containers are you buying? \n"); scanf(" [ select ] ["%d", "%c", "%f", "%lf"] ", & cartons); if ( [ select ] ["cartons / 2", "cartons % 1", "cartons % 2", "cartons % price", "cartons / price", "cartons / total"] [ select ] ["=", "==", "! =", "< =", "> =", "< "] 0) total = [ select ] ["price * cartons", "cartons * price / 2 + price", "(cartons / 2) * price", "cartons / (2.0 * price)", "(cartons / 2.0) * price + price", "((cartons / 2) * price) + price"] ; else total = ((cartons / 2) * price) + price; printf("the total cost is $%.2f.\n", total); return 0; }
Answers: 2
question
Computers and Technology, 24.06.2019 01:30
Hazel has just finished adding pictures to her holiday newsletter. she decides to crop an image. what is cropping an image?
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
Other - a written response, no less than arial 12-point font, to the following: of the following, which would you consider is most important to customer service goals? choose one and explain why. (1) accuracy (2) punctuality and attendance (3) courtesy (4) productivity (5) organization
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
Law, 11.04.2021 14:00
question
Mathematics, 11.04.2021 14:00
question
English, 11.04.2021 14:00
question
Mathematics, 11.04.2021 14:00