Python Programming Language: FAQs and Essential Information
Q1. who developed python programming language?
Ans. Python programming language was developed by Guido van Rossum. He started working on Python in December 1989 and the first version of Python was released on February 20, 1991.
Q2. which type of programming dose python support?
Ans. Python supports multiple programming paradigms, including object-oriented, functional, and procedural programming.
Q3. is Python case sensitive when dealing with identifies?
Ans. Yes, Python is case sensitive when dealing with identifiers. This means that names, variables, function names, and other identifiers in Python must always be written with the correct case. For example, "myVariable" is not the same as "myvariable" or "MyVariable".
Q4. what is the correct extension of the python file?
Ans. The correct extension for a Python file is ".py".
Q5. Is python code compiled or interpreted?
Ans. Python is an interpreted language.
Q6. Name a few blocks of code used define in python language?
Ans. In Python, there are several blocks of code used to define different structures, including:
-
Functions: A block of code that performs a specific task and can be called multiple times in a program. Functions are defined using the "def" keyword.
-
Classes: A blueprint for creating objects that defines a set of attributes and methods. Classes are defined using the "class" keyword.
-
Loops: A block of code that repeats a set of statements until a certain condition is met. There are two types of loops in Python: "for" loops and "while" loops.
-
Conditional statements: A block of code that executes one set of statements if a certain condition is met, and another set of statements if the condition is not met. The most common conditional statement in Python is the "if" statement.
Q7. State a character used to give single line comment in python?
Ans. "#"
Q8. Mention function which can help us to find the version of python that we are currently working on?
Ans.
import sys
sys.version
'3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:26:04) [GCC 10.4.0]'
Q9. Python supports the creation of anonymous functions at runtime, using a construct called _____________
Ans. lambda
Q10. what does pip stand for python?
Ans. PIP stands for "Pip Installs Packages". It is a package management system used to install and manage packages and libraries in Python.
Q11. Mention a few build-in function in python?
Ans. print(), len(), range(), int(), float(), str(), list(), tuple(), dict(), set(), etc.
Q12. What is the maximum possible length of an identifier in python?
Ans 79 characters
Q13. what are the benefits of using python?
Ans. The benefits of using Python include
- its simplicity and ease of use
- its support for multiple programming paradigms
- its vast libraries and tools
- its strong community and support
- its ability to handle a wide range of tasks and applications efficiently.
Q14. How is memory management in python?
Ans. Memory management in Python is performed automatically and is based on a private heap space, which is managed by the Python Interpreter. The Python Interpreter manages the allocation of memory for all Python objects and data structures, and it uses reference counting as the primary method of memory management.
Whenever a reference to that object is created, the reference count is incremented by 1. When an object's reference count drops to 0, it is automatically deleted and its memory is freed.
Python also uses a garbage collector to automatically collect and delete objects that are no longer referenced in the code.
Q15. How to install python on windows and set path variables?
Ans. Here are the steps to install Python on windows and set the PATH environment variable:
- Download the Python installer: Go to the official Python website (https://www.python.org/downloads/), and download the latest version of Python for Windows.
- Run the installer: Double click on the downloaded Python Installer, and follow instructions to complete the installation process.
- Update PATH environment variable: To set the PATH environment variable, follow these steps:
- Open the Start menu and search for "Environment Variables"
- Click on "Edit the system environment variables"
- In the System Properties window, click on the "Environment Variables" button
- Under "System Variables", scroll down and find the "Path" variable
- Click on the "Edit" button
- Click on the "New" button and add the path to the Python installation directory (e.g., C:\Python36\ or C:\Python37, depending on your version of Python)
- Click "OK" on all windows to save changes.
Q16. Is indentation required in python?
Ans. Yes, indentation is required in Python. Indentation is used to define blocks of code, such as control structures (if/else statements, for/while loops, etc.), functions, and classes. In Python, indentation must be consistent within a block of code, typically using 4 spaces for each level of indentation.
In [4]:
for i in range(10):print(i,end="")0123456789