Posts

State use of pep and pip

Uses of Pep :  This PEP proposes that the  Installing Python Modules  guide be updated to officially recommend the use of  pip  as the default installer for Python packages, rather than the current approach of recommending the direct invocation of the  setup.py install  command. Use of Pip : pip  has been chosen as the preferred default installer, as it is an already popular tool that addresses several design and user experience issues with its predecessor  easy_install  (these issues can't readily be fixed in  easy_install  itself due to backwards compatibility concerns).  pip  is also well suited to working within the bounds of a single Python runtime installation (including associated virtual environments), which is a desirable feature for a tool bundled with CPython. Other tools like  zc.buildout  and  conda  are more ambitious in their aims (and hence substantially better than  pip  at handling external binary dependencies), so it makes sense for the Python ecosystem to treat

Explain Python Path

Image
PYTHONPATH is an environment variable which the user can set to add additional directories that the user wants Python to add to the sys.path directory list. In short, we can say that it is an environment variable that you set before running the Python interpreter. Mostly you should not set these variables as they are not needed for Python to execute normal programs because it knows where its standard library is to be found. PYTHONPATH is used to help in importing the modules. So, when you import modules in your Python scripts, PYTHONPATH is also checked to see which directories might contain the imported module. How to add to the PYTHONPATH in windows? My Computer > Properties > Advanced System Settings > Environment Variables > Click the “New” button in the top half of the dialog, to make a new user variable. Give the variable name as PYTHONPATH and the value is the path to the code directory.   C lick OK and then OK to save this variable. To confirm  PYTHONPATH,  open Com

List key features of Python

Python Features Python provides many useful features which make it popular and valuable from the other programming languages. It supports object-oriented programming, procedural programming approaches and provides dynamic memory allocation. We have listed below a few essential features. 1) Easy to Learn and Use Python is easy to learn as compared to other programming languages. Its syntax is straightforward and much the same as the English language. There is no use of the semicolon or curly-bracket, the indentation defines the code block. It is the recommended programming language for beginners. 2) Expressive Language Python can perform complex tasks using a few lines of code. A simple example, the hello world program you simply type  print("Hello World") . It will take only one line to execute, while Java or C takes multiple lines. 3) Interpreted Language Python is an interpreted language; it means the Python program is executed one line at a time. The advantag

State IDLE in Python.

IDLE  is Python’s  Integrated Development and Learning Environment.  It allows programmers to easily write Python code. Just like Python Shell, IDLE can be used to execute a single statement and create, modify, and execute Python scripts. IDLE provides a fully-featured text editor to create Python scripts that include features like syntax highlighting, autocompletion, and smart indent. It also has a debugger with stepping and breakpoints features. This makes debugging easier. How does it work? The shell is the default mode of operation for Python IDLE. When you click on the icon to open the program, the shell is the first thing that you see: In IDLE, we write code line by line. Each specific line will handle one thing, and you can type whatever you want in that line and press enter to execute it. IDLE works more like a terminal or command prompt - You write one line, press enter, it executes.

Write steps for installing Python on window.

  Step 1 − Select Version of Python to Install Python has various versions available with differences between the syntax and working of different versions of the language. We need to choose the version which we want to use or need. There are different versions of Python 2 and Python 3 available. Step 2 − Download Python Executable Installer On the web browser, in the official site of python ( www.python.org ), move to the Download for Windows section. All the available versions of Python will be listed. Select the version required by you and click on Download. Let suppose, we chose the Python 3.9.1 version. On clicking download, various available executable installers shall be visible with different operating system specifications. Choose the installer which suits your system operating system and download the instlaller. Let suppose, we select the Windows installer(64 bits). The download size is less than 30MB. Step 3 − Run Executable Installer We downloaded the Pytho

Practical No 5 : Write Python program to demonstrate use of looping statement : "while " loop ,"for loop" and Nested loop ((MSBTE Pratical Question))

1. What would be the output from the following Python code segment x = 10 while x<5:     print x,     x = 1 Ans : Raised an error parenthesis required 2. Change the Python code from using a while loop to for loop: x =1 while x<10:     print x     x+=1 Ans: for i in range 10:     print(x)

Practical No 4: Write simple Python program to demonstrate use of conditional statement :if statement ,"if else statement" , Nested if statement ((MSBTE Pratical Question))

1. List operations used in conditional statement  Comparision Operator Logical Operator Identity Operator Membership Operator 2. Differentitate between if-else and nested-if statement Ans: if-else : Here their only single pair of if - else statement nested if statement         Here the statement is nesteed means their is a group of if statment inside another if statement