Filling blanks to modify nested function output

Report a typo

In Python, you are given a function named outer_function() which has another function inner_function() nested inside it. The outer_function() has a variable number initialized with a value of 5, while inner_function() attempts to modify this variable.

However, there are some missing pieces in the code. Your task is to fill in the blank in the inner_function() in such a way that calling outer_function() returns the string "Number in outer function: 10".

Fill in the gaps with the relevant elements
 outer_function():
    number = 5
    def inner_function():
         number
        number = 10
    inner_function()
     f"Number in outer function: {number}"

print(outer_function())
defnonlocalreturn
___

Create a free account to access the full topic