My issue
Program
My code
global_var = 10
def my_function():
print(global_var) # Accessing the global variable
print(global_var) # Accessible here
my_function() # Accessible here
def my_function():
local_var = 20 # Local variable
print(local_var) # Accessible here
print(local_var) # Error: local_var is not defined (outside its scope)
def my_function():
local_var = 20 # Local variable
print(local_var) # Accessible here
print(local_var) # Error: local_var is not defined (outside its scope)
Learning course: Learn Python
Problem Link: CodeChef: Practical coding for everyone