Python as a language -- what makes it high-level and dynamically typed, and how CPython actually runs a program.
Question 1: What is Python?
Ans
Python is a high-level, general-purpose programming language known for readable syntax, dynamic typing, a large standard library, and a broad ecosystem. It supports procedural, object-oriented, and functional programming styles.
Example
python
print("Hello, Python!")
Important Point
Python is interpreted in the common CPython workflow, but Python itself is a language specification with multiple implementations.
Question 2: Why is Python popular?
Ans
Python reduces the amount of code needed for many tasks and has mature libraries for web development, automation, data analysis, testing, AI, and scripting. Its readable syntax also makes it approachable for beginners.
Example
python
numbers = [1, 2, 3, 4]
print(sum(numbers))
Important Point
Popularity does not mean Python is ideal for every workload; CPU-heavy applications may need optimization or native extensions.
Question 3: What are Python's main features?
Ans
Important features include readable syntax, dynamic typing, automatic memory management, exceptions, modules and packages, first-class functions, comprehensions, generators, and a large standard library.
Example
python
squares = [x * x for x in range(5)]
print(squares)
Important Point
Python is dynamically typed, but it is still strongly typed: incompatible operations generally do not silently convert unrelated types.
Question 4: Is Python interpreted or compiled?
Ans
Python source is normally compiled to bytecode and then executed by a Python virtual machine in implementations such as CPython. Calling Python simply 'interpreted' is a useful simplification but not the whole execution model.
Example
text
.py -> bytecode -> Python runtime -> execution
Important Point
The exact compilation/execution strategy depends on the Python implementation.
Question 5: What is CPython?
Ans
CPython is the reference implementation of Python and the implementation most commonly installed from python.org. It translates Python source into bytecode and executes it using its runtime.