The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
class Example: num = 10 @staticmethod def add(num1, num2): result = (num1+num2)*Example.num return result print(Example.add(100, 200))
Line 7 invokes the static method add() of the class Example by passing 100 to num1 and 200 to num2 . When the Example class is accessed in line 7, the static variable num is initialized with 10 . Line 5 accesses the static variable num of the Example class and assigns 3000 to the result. Then, line 6 returns the value of result to line 7, which in return prints it. (geeksforgeeks.org/g-fact-34-class-or-static-variables-in-...)
Question difficulty: 🔵🔵🔵🔵🔵