Functions in Python - Python Functions - Scaler Topics
Functions in Python - Python Functions - Scaler Topics
Sign in
Example:
x = 5
def f1():
print("x in =", x)
f1()
print("x out=", x)
Output:
x in =5
x out=5
Live Events
Local Variables
Spark for Dat…
A variable declared inside the Function’s body is called a local variable. Such a Amit Singh
variable is said to have a local scope, i.e., it is only accessible within the Function 2
and not outside. 1778 January 3.00
2023 | Hrs
Example: 8:00 PM
Register with 1-
def f2():
Click
y = 3
Output:
x = 15
def f4():
x = 200
print("Local x:", x)
f4()
print("Global x:", x)