Which of the following is NOT a valid way to define a function in Python?
A. def my_function(x, y): return x + y
B. def my_function(x = 1, y = 2): return x * y
C. def my_function(): return “Hello, World!”
D. function my_function(x, y): return x – y
Answer:D
Which of the following is NOT a valid way to define a function in Python?
A. def my_function(x, y): return x + y B. def my_function(x = 1, y = 2): return x * y C. def my_function(): return “Hello, World!” D. function my_function(x, y): return x – y