Skip to content

Bhimashankark/introduction-to-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

introduction-to-python

Questions and answers for the fundamentals of learning Python

  1. Who developed Python Programming Language? Answer : Python programming language was developed by Guido van Rossum.

2 )Which type of Programming does Python support? Answer : Python supports several programming paradigms including: ● Object-Oriented Programming (OOP) ● Structured Programming ● Functional Programming ● Aspect-Oriented Programming (AOP)

  1. Is Python case sensitive when dealing with identifiers? Answer : Yes

4)What is the correct extension of the Python file? Answer : “Py”

  1. Is Python code compiled or interpreted? Answer : Python is interpreted

6 )Name a few blocks of code used to define in Python language? Answer : In Python, the following are some common blocks of code: ● Functions: Defined using the "def" keyword. ● Classes: Defined using the "class" keyword. ● Loops: "for" and "while" loops are used to repeatedly execute code. ● Conditional statements: "if" statements are used to conditionally execute code. ● Try-Except blocks: Used to handle exceptions and errors in the code. ● With blocks: Used to wrap the execution of a block of code with methods defined by a context manager.

  1. State a character used to give single-line comments in Python? Answer : ‘#’is used to give single line comment

  2. Mention functions which can help us to find the version of python that we are currently working on? Answer : print(sys.version) & print(sys.version_info)

9 )Python supports the creation of anonymous functions at runtime, using a construct called? Answer : "lambda expressions".

  1. What does pip stand for python? Answer : "pip" stands for "Pip Installs Packages". It is a package manager for Python packages, or modules if you like. With pip, you can easily install, upgrade, or uninstall packages for your Python projects.

11 )Mention a few built-in functions in python? Answer : print(), len(), int(),str(), float(), list(), tuple() etc

  1. What is the maximum possible length of an identifier in Python? Answer : there is no specific limit to the length of an identifier in python.

  2. What are the benefits of using Python? Answer : ● Easy to learn ● Versatile ● Large community ● High-level language ● Dynamic typing

14)How is memory managed in Python? Answer : Python uses a memory management system called "reference counting" to manage memory. The reference counting system keeps track of the number of references to an object in memory, and automatically frees the memory occupied by an object when its reference count drops to zero. In addition to reference counting, Python also uses a system called "garbage collection" to detect and reclaim objects that are no longer reachable from the code. The garbage collector periodically checks for objects in memory that are no longer reachable and frees the memory occupied by those objects. These two systems work together to provide automatic memory management in Python, freeing the programmer from having to manually manage memory allocation and deallocation.

15)How to install Python on Windows and set path variables? Answer : Here are the steps to install Python on Windows and set the path variables:

  1. Download the Python installer: Go to the official Python website (https://www.python.org/downloads/) and download the latest version of Python for Windows.
  2. Run the installer: Double-click the installer file you just downloaded and follow the on-screen instructions to install Python. Make sure to check the option to "Add Python to PATH" during the installation process.
  3. Verify the installation: Open the Command Prompt and type python to start the Python interpreter. If the installation was successful, you should see the Python prompt (>>>).
  4. Set the environment variables: To set the path variables, open the Start menu, search for "Environment Variables", and select "Edit the system environment variables". In the System Properties window that opens, click the "Environment Variables" button.
  5. Add to Path: In the "Environment Variables" window, scroll down to the "System variables" section and find the "Path" variable. Click "Edit" and then "New". Enter the path to the Python installation, for example, C:\Python3X\ (where X is the version number), and click "OK".
  6. Verify the Path: Close the environment variables window and open a new Command Prompt. Type python again and the Python interpreter should start. You should now be able to run Python from any directory in the Command Prompt.
  1. Is indentation required in python? Answer : Yes, indentation is required in Python. Indentation is used to define the block of code that belo”ngs to a particular control structure, such as a loop or a conditional statement.

About

Questions and answers for the fundamentals of learning Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published