subject

The following block of code is used in each part of the exercise. It is repeated for readability. 1| class Dog: 2| def __init__(self, name = "", owner = None): 3| self. name = name 4| self. owner = owner 5| def speak(self): 6| print("WOOF!") 7| 8| class Owner: 9| def __init__(self, name): 10| self. name = name 11| def speak(self): 12| print("My name is:", name) Imagine that we have applied the fix from Part 3 to this code. Then, imagine that after that class definition, we wrote the following code: 14| owner1 = Owner("David") 15| owner2 = Owner("Priyank") 16| dog1 = Dog("Fido", owner1) 17| dog2 = Dog("Barkley", owner2) 18| dog3 = Dog("Spot", owner2) 19| dog4 = Dog() 20| newList = [owner1, dog1, owner2, dog2, dog3, dog4] 21| for item in newList: 22| print(item. speak()) What would this code print?

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 02:30, hailey5campbelp7d1c0
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, wilkinsonei4069
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a, b] se pot scrie ca produs de două numere prime? “.
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, erick7123
Why do we mark tlc plates with pencil and not with pen
Answers: 2
image
Computers and Technology, 24.06.2019 09:30, kyreesegordon
Retype the statements, correcting the syntax errors. system. out. println("num: " + songnum); system. out. println(int songnum); system. out. println(songnum " songs"); note: these activities may test code with different test values. this activity will perform two tests: the first with songnum = 5, the second with songnum = 9. see how to use zybooks.
Answers: 1
You know the right answer?
The following block of code is used in each part of the exercise. It is repeated for readability. 1|...

Questions in other subjects:

Konu
Mathematics, 26.02.2020 02:22