Closures in Python with Examples

Master Python with 70+ Hands-on Projects and Get Job-ready - Learn Python

Program 1

def first():
    def second():
        a=700
        return a  
    return second()
    
       

# Driver Main
print(first())


          








# def first():
#     print("Hello Friends") 

# # Main Driver    
# myfun=first
# myfun()
# #print(myfun())






# Nested function
# def first():
#     print("First Outer Function")
#     def second():
#         print(" Second Inner Function")
#         def third():
#             print("Third Inner Function")    
#         third()
#     second()
    
# # Main Driver 
# first()


# function as an object
# def display():
#     print("Hello Friends")

# print(type(display))

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses
Image

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *