Saturday 29 August 2020

Nested Loop in Python

        

         Loop means repeating a group of statements for given number of times . 

    If you nest a Loop what happens one loop is kept inside another loop

so the outer and inner each itration of outer loop makes inner loop to run from starting to ending . outer loop 10 iterations  means 10 times inner loop completely repeated 

         


Tuesday 25 August 2020

About Python Virtual Machine

                                                About Python Virtual Machine

     As a programmer, we all know that a computer only understands machine language and every programming language converts its code to machine language. This is done by a compiler of that language. The Python compiler also does the same thing but in a slightly different manner.

When we run a Python program, two steps happen,
  1. The code gets converted to another representation called ‘Byte Code’
  2. ‘Byte Code’ gets converted to Machine Code (which is understandable by the computer)
The second step is being done by PVM or Python Virtual Memory. So PVM is nothing but a software/interpreter that converts the byte code to machine code for given operating system.
 
PVM is also called Python Interpreter and this is the reason Python is called an Interpreted language.
 
PVM(Python Virtual Machine) 
We can’t see the Byte Code of the program because this happens internally in memory.
 
But if we want to see the byte code of the program execute the below command:
 
D:\> python -m py_complie x.py
 
Here we are calling the Python compiler with the  -m option. -m represents module and the module name is py_compile. This module generates the .pyc file for .py file. *.pyc file contains the byte code of the Python program. One can open and see the byte code representation of the python program. To convert byte code into machine code/output use:
 
D:\> python <nameofpycfile>.pyc
 
Here Python would skip the step of byte code generation and would convert byte code directly to machine code.
This a brief About Python Virtual Machine

Sunday 23 August 2020

Python For Beginners

                         

 Python Notes 


Python given life by Guido von Rossum . Python came with version 1 and 2 

 Now 3 .Python Latest version is 3.9 .the Major version is three so we can 

Enjoy 3.9 but ready for download is 3.8 

We can download Python from “Python.org” Which is an official website of

our python programming language


What is Python:

       Python is an Object oriented Programming Language .It also supports

simple procedure oriented Programming.  Because of its rich library people

started Liking it .because every thing ready made user has to learn just

how to use it no need to crack his mind

  Areas like 

     Machine Learning,

     Artificial Intelligence

     Data Science 

     Web Development

     Game Development 

Have rich source of ready made library to use .If you take java,c++ any

other language you need to type a lot but in python the code gets very

short with fewer Lines of code you can finish your task. 





   

 




                                                 About Career And Python Introduction


Loops While Loop For Loop


Nested Loops Break, Continue,Pass 

List ,Tuple,Set,Dictionary
Formatted Output In Python


Python String Programs

Python Files and Exception Handling


Slicing Operator ,Variable Number of arguments,
Default Arguments in Functions



Class,Inheritence




       Python was conceptualized in the late 1980s. Guido van Rossum worked that time in a project at the CWI, called Amoeba, a distributed operating system. In an interview with Bill Venners1, Guido van Rossum said: "In the early 1980s, I worked as an implementer on a team building a language called ABC at Centrum voor Wiskunde en Informatica (CWI). I don't know how well people know ABC's influence on Python. I try to mention ABC's influence because I'm indebted to everything I learned during that project and to the people who worked on it."

Later on in the same Interview, Guido van Rossum continued: "I remembered all my experience and some of my frustration with ABC. I decided to try to design a simple scripting language that possessed some of ABC's better properties, but without its problems. So I started typing. I created a simple virtual machine, a simple parser, and a simple runtime. I made my own version of the various ABC parts that I liked. I created a basic syntax, used indentation for statement grouping instead of curly braces or begin-end blocks, and developed a small number of powerful data types: a hash table (or dictionary, as we call it), a list, strings, and numbers.


So, what about the name "Python"? Most people think about snakes, and even the logo depicts two snakes, but the origin of the name has its root in British humour. Guido van Rossum, the creator of Python, wrote in 1996 about the origin of the name of his programming language1: "Over six years ago, in December 1989, I was looking for a 'hobby' programming project that would keep me occupied during the week around Christmas. My office ... would be closed, but I had a home computer, and not much else on my hands. I decided to write an interpreter for the new scripting language I had been thinking about lately: a descendant of ABC that would appeal to Unix/C hackers. I chose Python as a working title for the project, being in a slightly irreverent mood (and a big fan of Monty Python's Flying Circus)."

Guido Van Rossum published the first version of Python code (version 0.9.0) at alt.sources in February 1991. This release included already exception handling, functions, and the core data types of list, dict, str and others. It was also object oriented and had a module system.

Python version 1.0 was released in January 1994. The major new features included in this release were the functional programming tools lambda, map, filter and reduce, which Guido Van Rossum never liked.

Six and a half years later in October 2000, Python 2.0 was introduced. This release included list comprehensions, a full garbage collector and it was supporting unicode.

Python flourished for another 8 years in the versions 2.x before the next major release as Python 3.0 (also known as "Python 3000" and "Py3K") was released. Python 3 is not backwards compatible with Python 2.x. The emphasis in Python 3 had been on the removal of duplicate programming constructs and modules, thus fulfilling or coming close to fulfilling the 13th law of the Zen of Python: "There should be one -- and preferably only one -- obvious way to do it."


The term "interactive" traces back to the Latin expression "inter agere". The verb "agere" means amongst other things "to do something" and "to act", while "inter" denotes the spatial and temporal position to things and events, i.e. "between" or "among" objects, persons, and events. So "inter agere" means "to act between" or "to act among" these.

With this in mind, we can say that the interactive shell is between the user and the operating system (e.g. Linux , Windows or others). Instead of an operating system an interpreter can be used for a programming language like Python as well. The Python interpreter can be used from an interactive shell.

The interactive shell is also interactive in the way that it stands between the commands or actions and their execution. In other words, the shell waits for commands from the user, which it executes and returns the result of the execution. Afterwards, the shell waits for the next input.

A shell in biology is a calcium carbonate "wall" which protects snails or mussels from its environment or its enemies. Similarly, a shell in operating systems lies between the kernel of the operating system and the user. It's a "protection" in both directions. The user doesn't have to use the complicated basic functions of the OS but is capable of using the interactive shell which is relatively simple and easy to understand. The kernel is protected from unintentional and incorrect usages of system functions.

Python offers a comfortable command line interface with the Python Shell, which is also known as the "Python Interactive Shell". It looks like the term "Interactive Shell" is a tautology, because "shell" is interactive on its own 

  The Python interpreter can be invoked by typing the command "python" without any parameter followed by the "return" key at the shell prompt:

python



The Python Tutorial

Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.

The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python Web site, https://www.python.org/, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation.

The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). Python is also suitable as an extension language for customizable applications.

This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well.

For a description of standard objects and modules, see The Python Standard LibraryThe Python Language Reference gives a more formal definition of the language. To write extensions in C or C++, read Extending and Embedding the Python Interpreter and Python/C API Reference Manual. There are also several books covering Python in depth.

This tutorial does not attempt to be comprehensive and cover every single feature, or even every commonly used feature. Instead, it introduces many of Python’s most noteworthy features, and will give you a good idea of the language’s flavor and style. After reading it, you will be able to read and write Python modules and programs, and you will be ready to learn more about the various Python library modules described in The Python Standard Library.

The Glossary is also worth going through.




 

                  Packages In Python  How  To  use   Them  package is a folder in python in which we have  modules .each file in that folde...

Python For beginner