G-KLRRFEPK7Z Introduction to Python Programing Language Skip to main content

Introduction to Python Programing Language

 



What is Python?

Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.

Guido van Rossum



It is used for:


web development (server-side),

software development,

mathematics,

system scripting.



What can Python do?

Python can be used on a server to create web applications.

Python can be used alongside software to create workflows.

Python can connect to database systems. It can also read and modify files.

Python can be used to handle big data and perform complex mathematics.

Python can be used for rapid prototyping, or for production-ready software development.

Why Python?

Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).

Python has a simple syntax similar to the English language.

Python has syntax that allows developers to write programs with fewer lines than some other programming languages.

Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.

Python can be treated in a procedural way, an object-oriented way or a functional way.

Good to know

The most recent major version of Python is Python 3, which we shall be using in this tutorial. However, Python 2, although not being updated with anything other than security updates, is still quite popular.

In this tutorial Python will be written in a text editor. It is possible to write Python in an Integrated Development Environment, such as Thonny, Pycharm, Netbeans or Eclipse which are particularly useful when managing larger collections of Python files.

Python Syntax compared to other programming languages

Python was designed for readability, and has some similarities to the English language with influence from mathematics.

Python uses new lines to complete a command, as opposed to other programming languages which often use semicolons or parentheses.

Python relies on indentation, using whitespace, to define scope; such as the scope of loops, functions and classes. Other programming languages often use curly-brackets for this purpose. 




Syntax and semantics

Python is meant to be an easily readable language. Its formatting is visually uncluttered and often uses

English keywords where other languages use punctuation. Unlike many other languages, it does not use curly

brackets to delimit blocks, and semicolons after statements are allowed but rarely used. It has fewer

syntactic exceptions and special cases than C or Pascal.


Python's statements include:

The assignment statement, using a single equals sign =

The if statement, which conditionally executes a block of code, along with else and elif (a

contraction of else-if)

The for statement, which iterates over an iterable object, capturing each element to a local variable

for use by the attached block

The while statement, which executes a block of code as long as its condition is true

The try statement, which allows exceptions raised in its attached code block to be caught and

handled by except clauses (or new syntax except* in Python for exception groups

it also ensures that clean-up code in a finally block is always run regardless of how the block

exits

The raise statement, used to raise a specified exception or re-raise a caught exception

The class statement, which executes a block of code and attaches its local namespace to a class,

for use in object-oriented programming

The def statement, which defines a function or method

The with statement, which encloses a code block within a context manager (for example, acquiring a

lock before it is run, then releasing the lock; or opening and closing a file), allowing resource-

acquisition-is-initialization (RAII)-like behavior and replacing a common try/finally idiom

The break statement, which exits a loop

The continue statement, which skips the rest of the current iteration and continues with the next

The del statement, which removes a variable—deleting the reference from the name to the value,

and producing an error if the variable is referred to before it is redefined

The pass statement, serving as a NOP, syntactically needed to create an empty code block

The assert statement, used in debugging to check for conditions that should apply

The yield statement, which returns a value from a generator function (and also an operator); used

to implement coroutines

The return statement, used to return a value from a function

The import and from statements, used to import modules whose functions or variables can be

used in the current program

The assignment statement ( = ) binds a name as a reference to a separate, dynamically allocated object.

Variables may subsequently be rebound at any time to any object. In Python, a variable name is a generic

reference holder without a fixed data type; however, it always refers to some object with a type. This is

called dynamic typing—in contrast to statically-typed languages, where each variable may contain only a

value of a certain type.

Python does not support tail call optimization or first-class continuations, and, according to Van Rossum,

it never will.

However, better support for coroutine-like functionality is provided by extending

Python's generators.

Before generators were lazy iterators; data was passed unidirectionally out

of the generator. From Python on, it is possible to pass data back into a generator function; and from

version it can be passed through multiple stack levels.



... Easy example.. :-














My contact

Facebook

Comments

Post a Comment

Popular posts from this blog

πŸŽ“ My Diploma Journey in IT Engineering

From Zero to Hero – Powered by Dreams, Discipline, and Dedication This is me!!! By: UNAGAR CHIRAGBHAI PRAVINBHAI Institute: Government Polytechnic, Rajkot Branch: Information Technology | Enrollment: 226200316210         πŸ”° Introduction Hello reader, I’m Chirag Unagar, and this is the story of how I turned three years of my diploma into a life-changing transformation. From struggling in the beginning to securing consistent results with no backlogs and a 9.66 CGPA , my journey is proof that hard work beats fear and confusion. πŸ“˜ Semester-Wise Growth Story πŸ“— Semester 1 – The Nervous Beginning (Winter 2022) When I entered college, I had a mix of excitement and fear. The world of IT felt huge, and I wasn’t sure where to start. But I faced it step by step. πŸ“š Subjects Covered: Mathematics Communication Skills in English Sports & Yoga Python Programming Introduction to IT Systems Static Web Page Design πŸ“ˆ My Result: All grades AA o...

Universal largest black hole(Ton 618)

This is an ordered list of the most massive black holes so far discovered (and probable candidates), measured in units of solar masses (M☉), approximately 2×1030 kilograms. An artist's impression of a supermassive black hole devouring matter from an accretion disc Introduction: PComparisons of large and small black holes in galaxy OJ 287 to the Solar System. A supermassive black hole (SMBH) is an extremely large black hole, on the order of hundreds of thousands to billions of solar masses (M☉), and is theorized to exist in the center of almost all massive galaxies. In some galaxies, there are even binary systems of supermassive black holes, see the OJ 287 system. Unambiguous dynamical evidence for SMBHs exists only in a handful of galaxies;[1] these include the Milky Way, the Local Group galaxies M31 and M32, and a few galaxies beyond the Local Group, e.g. NGC 4395. In these galaxies, the mean square (or root mean square) velocities of the stars or gas rises as ~1/r near the center...

Largest Star In Universe ( UY Scuti)

  UY Scuti 46 languages Article Talk Read View source View history Coordinates :    18 h  27 m  36.53 s , −12° 27′ 58.9″   From Wikipedia, the free encyclopedia For the album, see  UY Scuti (album) . UY Scuti DSS2  image of  red supergiant  star UY Scuti (brightest star in the image), surrounded by a dense starfield. Observation data Epoch   J2000        Equinox   J2000 Constellation Scutum Right ascension 18 h  27 m  36.5334 s [1] Declination −12° 27′ 58.866″ [1] Apparent magnitude  (V) 8.29 - 10.56 [2] Characteristics Evolutionary stage Red   hypergiant [3] Spectral type M2-M4Ia-Iab [2] U−B  color index +3.29 [4] B−V  color index +3.00 [5] Variable type SRc [6] Astrometry Radial velocity  (R v ) 18.33 ± 0.82 [7]  km/s Proper motion  (ΞΌ) RA:  1.3 [8]   mas / yr Dec.:  −1.6 [8]   mas / yr Parallax ...