A paver was supposed to lay paving blocks evenly in one row. However, he was in a good mood and left random gaps between individual blocks. Create a program paving_stonesocky.py and in it a function row with the parameter y, which will draw 20 blocks of size 10×10 next to each other on the drawing canvas. The first block has the x-coordinate of its top-left corner equal to 10, and each next one has its x-coordinate increased by a random number from the range 12–20. All blocks have the same y-coordinate, which is given by the parameter y. Call the function in the following way:
for i in range(15):
rad(5 + i * 15)
The result should look similar to the picture:
__init__ MethodCreate a class Person, where creating an object will look like this:
jessa = Person('Jessa', 'Female', 'Software Engineer')
The class will contain two methods, show and work, which, when called, will print the following:
Name: Jessa Sex: Female Profession: Software Engineer
Jessa working as a Software Engineer
__str__ MethodThere are several similar “underscored” (special) methods. For example, the __str__ method. Python calls this method when it needs to convert an object to a string:
class Maciatko:
def __init__(self, meno):
self.meno = meno
def __str__(self):
return f'<Maciatko menom {self.meno}>'
def zamnaukaj(self):
print(f"{self.meno}: Mňau!")
def zjedz(self, jedlo):
print(f"{self.meno}: Mňau mňau! {jedlo} mi chutí!")
murko = Maciatko('Murko')
print(murko)
Task 1: Complete the following steps:
__init__ method that takes name and age as parametersTask 2: Falling Balls
From the page https://www.w3resource.com/python-exercises/tkinter/python-tkinter-canvas-and-graphics-exercise-10.php copy the code and modify it so that the falling speed of the ball increases as the score increases.