Create a class, Car
Create a dog, my_car, with two attributes, brand and year.
Change my_car's brand
Add one year to my_car
class Hospital:
pass
class Doctor:
pass
d1, d2 = Doctor(), Doctor()
d1.name, d2.name = "Dr. Liri", "Dr. Mirlinda"
h = Hospital()
h.staff = {"cardiology": d1, "urologji": d2}
print(h.staff["urologji"].name)
What is printed when we execute the above script
Create a class named Dog
Create a dog, dog, with two attributes, name and age.
Change dog's name
Add one year to dog
Create a class, any instance of it, save them to variables, and assign any attribute to this instance.
Create two classes, Library and Book.
Create a library, library and add some books to library.books dictionary
whose keys are characters and values are list of books whose title start with that character.
Example:
{'a': [<Book whose title is 'Ali baba'>, ...], 'o': [<Book whose title is 'Of Mice and Men'>, ...]}
Add a new book that starts with 's'.
Print the first book that starts with 's'.
Create a class named Person
Create an instance of Person and assign it to friend
Assign two attributes to car1, name and age, with values "Elira" and 29 respectively.
class Room:
pass
r = Room()
r.name = "Living Room"
r.lights_on = False
r.lights_on = True
What is the value of the following expressions at the end of execution of the above script?
| r.name: | ||
| r.lights_on: |
Create two classes, Bird and Nest.
Create a bird, with species: str and nest: Nest attributes.
Create a class, Shoe
Create a shoe, s, with one attribute, size.
Add 1 to s's size
Create two classes, Concert and Performer.
Create some performers with one attribute, name.
Create a concert and add created performers to its performers: list attribute.
Print names of all concert performers