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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:30, angoraspinner
These tools give presenters more freedom to move about the room and interact with their audience. laptop computer laser pointer lcd projector remote control
Answers: 2
image
Computers and Technology, 22.06.2019 09:00, jgrable5175
Designing a mobile web page is a little different from designing a regular web page. name at least three features that should be considered when designing a website that is mobile phone-friendly, and briefly explain why they are important.
Answers: 1
image
Computers and Technology, 22.06.2019 11:30, LindseyN1
One subtask in the game is to roll the dice. explain why is roll the dice an abstraction.
Answers: 3
image
Computers and Technology, 22.06.2019 14:10, normarismendoza
Dean wants a quick way to look up staff members by their staff id. in cell q3, nest the existing vlookup function in an iferror function. if the vlookup function returns an error result, the text “invalid staff id” should be displayed by the formula. (hint: you can test that this formula is working by changing the value in cell q2 to 0, but remember to set the value of cell q2 back to 1036 when the testing is complete.)
Answers: 3
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 in other subjects:

Konu
Mathematics, 17.12.2020 06:10