Question: * Create a variable outside of a function, and use it inside the function x = awesome def myfunc ( ) : print (

* Create a variable outside of a function, and use it inside
the function
x = "awesome"
def myfunc():
print("Python is "+ x)
myfunc()
-Run this and add the screenshot of it as your submission.
Next, modify your code, and create a variable with the
same name inside a function, this variable will be local,
and can only be used inside the function. The global
variable with the same name will remain as it was, global
and with the original value. Run this and add the
screenshot of it as your submission.
x= "awesome"
def myfunc():
x= "fantastic"
print("Python is "+ x)
myfunc()
print("Python is "+ x)
* Create a variable outside of a function, and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!