Intern
What needs to be done for the function to return a value?
sobes.tech AI
Answer from AI
Use the return keyword inside a function.
def my_function(x):
// Calculate or obtain the value
result = x * 2
// Return the value
return result
// Call the function and get the returned value
value = my_function(5)
// The variable value will contain 10