Help me with my code please I have a bug in line 33

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Help me with my code please I have a bug in line 33
stay_alive.py
12 # Create the player instance and a count variable
13 player = ts_game.Player()
14 count = 0
15
16 # Open doors until the player is out of lives
17 while player.lives > 0:
18
19
20
# Print the player's health and lives
print ()
print ("Your health: " + str(player.health))
print ("Your remaining lives: " + str(player.lives))
21
22
23
24
25
26
# Create two new doors
doorl = ts_game.Door()
door2 = ts_game.Door()
27
28
# Ask which door the user chooses
choice = input ("Two doors appear before you. Which door do you want to open,
29
30
31
32
count += 1
体3
34
35 else:
# Open whichever door the user chose
if choice = door:
ts_game.open_door(player, door1)
ts game.open_door (player, door2)
39 print ()
+ str(count) +
t("That was your last life! You opened a total of
%3D
doors.
40
7890
33334
Transcribed Image Text:stay_alive.py 12 # Create the player instance and a count variable 13 player = ts_game.Player() 14 count = 0 15 16 # Open doors until the player is out of lives 17 while player.lives > 0: 18 19 20 # Print the player's health and lives print () print ("Your health: " + str(player.health)) print ("Your remaining lives: " + str(player.lives)) 21 22 23 24 25 26 # Create two new doors doorl = ts_game.Door() door2 = ts_game.Door() 27 28 # Ask which door the user chooses choice = input ("Two doors appear before you. Which door do you want to open, 29 30 31 32 count += 1 体3 34 35 else: # Open whichever door the user chose if choice = door: ts_game.open_door(player, door1) ts game.open_door (player, door2) 39 print () + str(count) + t("That was your last life! You opened a total of %3D doors. 40 7890 33334
Code
Unit 3. Loops
Lesson 3.3: Classes
8O Turned in Tue. Apr 5.
4T
stay_alive.py
2 Classes
3 Technique Demo: Change an Instance with a Function
4 Stay Alive
6.
7 import ts_game
8.
9 # Print instructions
10 print ("Choose which of two possible doors to walk through. Be careful, though, as opening some
11
12 # Create the player instance and a count variable
player = ts_game.Player()
14 count = 0
15
16 # Open doors until the player is out of lives
17 while player.lives > 0:
18
# Print the player's health and lives
print()
print ("Your health: " + str(player.health))
print ("Your remaining lives:
19
20
21
22
+ str(player.lives))
23
24
25
# Create two new doors
doorl = ts_game.Door()
door2 = ts_game.Door()
26
27
28
# Ask which door the user chooses
choice = input ("Two doors appear before you. Which door do you want to open, 1 or 2? ")
29
30
count += 1
21
PROJECT
CODE ASSIST
Transcribed Image Text:Code Unit 3. Loops Lesson 3.3: Classes 8O Turned in Tue. Apr 5. 4T stay_alive.py 2 Classes 3 Technique Demo: Change an Instance with a Function 4 Stay Alive 6. 7 import ts_game 8. 9 # Print instructions 10 print ("Choose which of two possible doors to walk through. Be careful, though, as opening some 11 12 # Create the player instance and a count variable player = ts_game.Player() 14 count = 0 15 16 # Open doors until the player is out of lives 17 while player.lives > 0: 18 # Print the player's health and lives print() print ("Your health: " + str(player.health)) print ("Your remaining lives: 19 20 21 22 + str(player.lives)) 23 24 25 # Create two new doors doorl = ts_game.Door() door2 = ts_game.Door() 26 27 28 # Ask which door the user chooses choice = input ("Two doors appear before you. Which door do you want to open, 1 or 2? ") 29 30 count += 1 21 PROJECT CODE ASSIST
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY