Ask Question
12 August, 18:26

Val = 25

def example ():

global val

val = 15

print (val)

print (val)

example ()

print (val)

what is the output?

+1
Answers (1)
  1. 12 August, 22:05
    0
    25 15

    15

    Explanation:

    The first, print (val) will be printed, and here the value of val is 25 as set outside the function. Then the print (val) inside the example () will be printed, and here we have declared val as global and set its value to 15, And with last print as well, since the val is now global and with value 15, and hence the output will be 15. And hence the output is as above.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Val = 25 def example (): global val val = 15 print (val) print (val) example () print (val) what is the output? ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers