local variable, global variable in python

amitmund June 03, 2026
x = "Hello"

def myfunc():
  print("Python is " + x)

myfunc()
x = "Hello"

def myfunc():
  x = "CTTC"
  print("Python is " + x)

myfunc()

print("Python is " + x)

0 Likes
5 Views

Filters

No filters available for this view.

Reset All