Python_Viva_Questions_Answers_Part1 (2)
Python_Viva_Questions_Answers_Part1 (2)
1. What is Python?
Python is a high-level, interpreted programming language known for its easy syntax and readability. It
programming.
- Interpreted language
- Dynamically typed
- Object-oriented
- Open-source
A compiler translates the entire source code into machine code at once before execution, while an interpreter
Python is an interpreted language, meaning the code is executed line-by-line by the Python interpreter.
Variables are used to store data. In Python, you declare a variable by simply assigning it a value, e.g., x = 10.
Keywords are reserved words in Python with special meaning. Examples include: if, else, while, for, def.
Common data types in Python include int, float, str, list, tuple, set, dict, and bool.
Typecasting is converting one data type to another, e.g., int('5') to convert string '5' to integer.
In Python 2, raw_input() reads input as a string, while input() evaluates it. In Python 3, only input() exists and
Comments are notes in the code for explanation. Single-line comments start with #. Multi-line comments can