Python Constructs
1. Functions in Python
A function in Python is a collection of statements grouped under a name. You can use it whenever you want to execute all those statements at a time.
You can call it wherever you want and as many times as you want in a program. A function may return a value.
2. Classes in Python
Python is an object-oriented language. It supports classes and objects.
A class is an abstract data type. In other words, it is a blueprint for an object of a certain kind. It holds no values.
An object is a real-world entity and an instance of a class.
3. Modules in Python
Python module is a collection of related classes and functions.
We have modules for mathematical calculations, string manipulations, web programming, and many more.
4. Packages in Python
Python package is a collection of related modules. You can either import a package or create your own.
Python has a lot of other constructs. These include control structures, functions, exceptions, etc
1. Functions in Python
A function in Python is a collection of statements grouped under a name. You can use it whenever you want to execute all those statements at a time.
You can call it wherever you want and as many times as you want in a program. A function may return a value.
2. Classes in Python
Python is an object-oriented language. It supports classes and objects.
A class is an abstract data type. In other words, it is a blueprint for an object of a certain kind. It holds no values.
An object is a real-world entity and an instance of a class.
3. Modules in Python
Python module is a collection of related classes and functions.
We have modules for mathematical calculations, string manipulations, web programming, and many more.
4. Packages in Python
Python package is a collection of related modules. You can either import a package or create your own.
Python has a lot of other constructs. These include control structures, functions, exceptions, etc
👍20❤3