Q:

Value not defined when inside a function

When I attempt to print a value I get an error stating that the value is not defined.
def myFunc():
    myValue = "Hello World!"

myFunc()
print(myValue)

I was expecting myValue to be printing "Hello World!" however this is not the case.

A:

Some doc (Programming FAQ, Python 3.7.4) says:

In Python, variables that are only referenced inside a function are
  implicitly global. If a variable is assigned a value anywhere within
  the function's body, it's assumed to be a local unless explicitly
  declared as global.

Then your variable is local to the function that means that this variable doesn't exist outside it. So if you really need to access it outside, then declare it as global:
def myFunc():
  global myValue
  myValue = "Hello World!"
print(myValue)  

