reading-notes

Testing and Modules

why this topic matters

Reading Questions

### 1. What are the key principles of Test-Driven Development (TDD) in Python, and how do they contribute to the overall quality of code?
Test Driven Development is the process in which test cases are written before the code that validates those cases. It depends on repetition of a very short development cycle.
Test driven Development is a technique in which automated Unit test are used to drive the design and free decoupling of dependencies

Benefits:

2. Explain the purpose of the if __name__ == ‘__main__’: statement in Python scripts. What are some use cases for including this conditional in your code?

used in Python scripts to control the execution of the script. It checks the value of the name attribute, which is a built-in variable that is set by the Python interpreter when a script is executed. ###execute the code only if it is called as a script and not execute when it is imported as a module.

3. Describe the concept of recursion in Python.

The term Recursion can be defined as the process of defining something in terms of itself. In simple words, it is a process in which a function calls itself directly or indirectly.

4. What is the difference between Python modules and packages? Explain how to create, import, and use them in your Python programs.

Modules in Python A module is a file with the extension.py that contains Python or C executable code. A module is made up of a number of Python statements and expressions.

Packages in Python To provide an application development environment, a python package establishes a hierarchical directory structure with several modules and sub-packages. They are nothing more than a bundle of modules and sub-packages.

differencies

### how to create ,import ,and use modules?