def some_function(*args, **kwargs): return args, kwargs result = some_function(1, 2, a=3, b=4) print(result)
result
((1, 2), {'a': 3, 'b': 4})
([1, 2], {'a': 3, 'b': 4})
((1, 2), ('a': 3, 'b': 4))
([1, 2], ('a': 3, 'b': 4))
args
kwargs
Discuss About this Question.
x = 5 y = x if x > 10 else x/2 print(y)
y
x
x > 10
x/2
def func(x, y, z): return x + y * z result = func(1, 2, 3) print(result)
def modify_list(my_list): my_list[0] = 5 original_list = [1, 2, 3] modify_list(original_list.copy()) print(original_list)
modify_list
class CustomError(Exception): def __init__(self, message): super().__init__(message) raise CustomError("An example custom error.")
TypeError
NameError
CustomError
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.