def my_decorator(func): def wrapper(*args, **kwargs): result = func(*args, **kwargs) return result * 2 return wrapper @my_decorator def my_function(x): return x + 1 result = my_function(5) print(result)
result
Discuss About this Question.
x = 2 y = 3 result = x * y ** x print(result)
class MyClass: x = 10 obj = MyClass() obj.x += 5 result = obj.x print(result)
x
obj
x = [1, 2, 3] y = x[:] y[0] = 10 print(x)
y
string1 = "Python" string2 = string1 string2 += " is great" result = string1 + string2 print(result)
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.