Using variables inside functions?

it is possible use variables in the function which is defined out of function.?


Yes, called global variable.

Obviously u can use , those are called Global variables .But you can not use the variables you used inside the function and accessing it from outside . To access them outside you need to return those from the function

Yes you can use the variable which is defined outside the function… basically it is called global variable and that can be used any place inside that file

Yes, we can create global variables in python. For more info, please visit the following link:

Created the loan_emi function, as stated “Local Variable can be used in the function, however not accessible outside the function.”

emi3 = loan_emi(amount=800000, down_payment = .25amount, duration = 612, rate = 7/12)
I have reused the amount variable and facing the below error: NameError: name ‘amount’ is not defined