Python Methods: What is the output of the code below?

Code

class A :
    x = 10
    def __init__(self, y,z):
        self.y = y
        self.z = z
           
    def update_y(self):
        self.y = self.y * self.x
   
    @classmethod
    def update_z(cls):
        self.z = self.z + 20

A1 = A(3,4)
A2 = A(5,6)

A2.update_z()
A1.y + A2.z
Tags

Function Parameters: Functions can be used inside a list comprehension too.

An example to create a list, the elements of which would be the result of applying the function 
x2−2x−2 on each element in the list = [2, 7, 8, 10, 3] is shown below:

L1 = [2, 7, 8, 10, 3]

def func(y):
    return ____- 2 * y - 2

ans_list = [func(x) for  ______ ]
ans_list

The missing parts of the code include _____.

Tags
programsbuzz banner