0% found this document useful (0 votes)
5 views21 pages

Python 1

Python is a high-level, versatile programming language known for its readability and ease of use, developed by Guido Van Rossum in 1991. It supports various programming paradigms and has an extensive standard library, although it is not the fastest language. The document covers basic concepts such as writing code, tokens, keywords, identifiers, literals, operators, and terminal commands.

Uploaded by

Sonu Shaukeen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views21 pages

Python 1

Python is a high-level, versatile programming language known for its readability and ease of use, developed by Guido Van Rossum in 1991. It supports various programming paradigms and has an extensive standard library, although it is not the fastest language. The document covers basic concepts such as writing code, tokens, keywords, identifiers, literals, operators, and terminal commands.

Uploaded by

Sonu Shaukeen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

elcome to Python Programmi

Python is HLL, versatile, and general-purpose


programming language. Known for its readability
and ease of use.

It was developed by Guido Van Rossum in 1991.


• Python IDLE
• https://www.python.org/

• VS Code
• https://code.visualstudio.com/
Writing your first code:

print(“Hello, World”)

The print function prints the message to the screen


Why to choose Python?

• Simple and Easy to learn


• Cross-Platform
• Versatility
• Interpreted
• Dynamic Typing
• Support OOPs, POPs Functional programming
• Extensive Standard Library
Drawback: Not the fastest language
Two ways to write code:

Interactive Mode
Scriptive Mode
or REPL
Tokens: The smallest fundamental unit of the
program.

def divide_two_numbers(a,
b):
if b == 0:
print(“Zero
Division Error”)
else: print(a/b)

https://docs.python.org/3/library/token.htm
l
Keywords: Reserved words having special
meaning to the language compiler.
False await else import pass

None break except in raise

True class finally is return

and continue for lambda try

as def from nonlocal while

assert del global not with

async elif if or yield


Identifiers: User-defined names given to
different parts of the program.
Rules for writing Identifiers:

• Can contain numbers, alphabets, or underscores


(_)
• Must start with an alphabet or underscore.
• Must not be any keyword.
• Except underscore no special symbol is allowed.
Literals: Represents the fixed value of
different data types also called constants.

For Example:
Types of Literals:

• String Literals
• Numeric literals
• Floating Literals
• Complex Literals
• Special Literals (None)
Punctuators: Special Symbols that help you
define the structure and syntax of your
code.
Operators: Symbols that operate on
values.
Types of operators:

• Unary & Binary


• Arithmetic operator
• Relational Operators
• Logical operator
• Bitwise operator
• Identity operator
• Member Operator
• shift operator
Precedence: order of execution of operator

Associativity: order of execution of same


precedence operator
Operator Associativity
() Highest
** Right to Left
+, -, X (unary) Left to Right
*, /, //, % Left to Right
+, - Left to Right
<<, >> Left to Right
& Left to Right
^ Left to Right
~ Left to Right
=, Is, is not, in, not in, <, <=, >,
>=, ==, !=. Left to Right
Not x Left to Right
And Left to Right
Or Left to Right
If else Left to Right
Lambda Left to Right
=, +=, -=, *=, /= //= ,%= Lowest
Some of the Terminal Commands

• ls
• mkdir
• pwd
• cd
• . (Period)
• .. (Double Period)
• rmdir
• clear
• code
• python
Thank you

You might also like