1. Describe Python and the reasons of its popularity.
Ans:
Python is popular and easy-to-learn programming language. Its used in many fields like web development, data science and automation. Its simple syntax and strong community support make it beginner friendly.
2. What is PEP 8 and why should we follow it?
Ans:
PEP 8 is collection of guidelines that help you write clean, understandable Python code. Following it keeps things orderly and improves the teams understanding of each others code.
3. How are lists and tuples different in Python?
Ans:
Lists can changed after they are created but tuples cannot. This means lists are flexible and tuples are fixed once made. Lists are used when data might change tuples are for fixed data.
4. How does the Python handle memory?
Ans:
Python takes care of memory by itself using a system called automatic memory management. It keeps track of which data is being used and clears out unused data to save space.
5. What are the main types of data in Python?
Ans:
Python has built in data types like numbers, text, lists, tuples, sets and dictionaries. These help store and manage different kinds of information in your programs.
6. How are values passed into functions in Python?
Ans:
When you use a function in Python you can send it values to work with. Python decides whether to send a copy or the actual value depending on the data type and how its used.
7. What is the Global Interpreter Lock in Python?
Ans:
GIL is part of Python that allows only one task to run at a time, even on computers with multiple processors. Its mainly used to make sure the system works safely but it can limit speed in some cases.
8. What is a module in Python and how is it different from a package?
Ans:
A module is single file that contains Python code like functions or variables A package is a group of modules organized together in folders. Packages help organize bigger projects.
9. What are some popular built in libraries in Python?
Ans:
Python has many built in libraries like math for numbers, datetime for dates and os for working with files and folders. These tools help you do more without writing extra code.
10. How can memory usage be handled better in Python?
Ans:
Python manages the memory automatically, but you can help by writing clean code, removing unused data and being careful with large files or data. This keeps your programs running smoothly.