0

How can I print value of var n if one of the argument of constructor of a class and var name is same but different values ?

class FirstClass: n = 9 def __init__(self,n): n = n // 4 self.n = n a = FirstClass(8) print(a.n) # >>> 2 #How can I output 9 for variable n and 2 for an argument in the constructor ?

7th Nov 2020, 6:23 AM
Rajan K
Rajan K - avatar
1 Resposta
0
Kuba Siekierzyński Help me out on this problem.
7th Nov 2020, 6:25 AM
Rajan K
Rajan K - avatar