Ask Question
20 December, 19:46

Val = 25

def example ():

global val

val = 15

print (val)

print (val)

example ()

print (val)

what is the output?

+4
Answers (1)
  1. 20 December, 23:16
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers