0% found this document useful (0 votes)
4 views15 pages

Python One Note Notes For Workshop

The document provides an overview of Python as a high-level, general-purpose programming language that simplifies coding by managing low-level details automatically. It discusses Python's features, such as being open-source, dynamically typed, and portable across different operating systems, as well as its data types and operators. Additionally, it highlights Python's popularity due to its simplicity and the growing demand for machine learning and data science applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views15 pages

Python One Note Notes For Workshop

The document provides an overview of Python as a high-level, general-purpose programming language that simplifies coding by managing low-level details automatically. It discusses Python's features, such as being open-source, dynamically typed, and portable across different operating systems, as well as its data types and operators. Additionally, it highlights Python's popularity due to its simplicity and the growing demand for machine learning and data science applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python programming

Sunday, October 23, 2022 9:30 AM

High level programming language means programmer


friendly language

no need to convert into machine level language.

we are not required to worry about low level things

like converting into binary


memory alloaction like that
every thing will be taken care by python.

General purpose means

we can develop desktop applications


dekstop appliacations are also known as standalon
applications

which can run on single computer

[Link]
[Link]
[Link]

we can develop web applications

[Link]
[Link]

for developing network applications


for developing games
mi,datascience, datasciene, data analysis

any where we will see data science with python

we never see data science with c language


data science with java

[Link] was developed by Guido Van Rossum

[Link] the Year 1989 While he was Working in Netherland


National Research Institute

[Link] Date of Birth of Python is feb 20 1991

Why name Python?

[Link] Van Rossum is Very Much impressed with the


show The Complete Monty Python's Circus
[Link] Show Was Broadcasted in BBC
From 1969 to 1974

Why Python became So Poplular?


[Link] is a simple language , Easy to Understand
a=10
b=20
c=30 if a>b else 40
print(c)

We can Write very less Code

#include<stdio.h> python came in 1989 but


main() why it became popular
{ in 2019
int a=10,b=20
main() why it became popular
{ in 2019
int a=10,b=20
printf("%d",a+b); because market requirements
} keep on changing
we have to write less code
concise code
a=10 everyone talking about
b=20 machine learning
a+b ai

Hello friends learning python


is so easy

if you are feeling difficulty ,

then your nursery standard is


not upto the mark

Features Of Python

[Link] and Easy to Learn

Do you know english?

In english howmany words are there?


crores, millions, if we observe oxford dictionary, a big
dictionary will be there.

so learning english is not much easy import keyword


[Link]
java there are 53 reserved words
python 35 reserved words
[Link] ware and opensource
free ware means we are not require to pay anything
opensource means code open

if we can change the python code based on our


requirements
so that is the reason multiple flavours are available in
python
j python
we can we can work with java programming language
anaconda python

we can design data science applications

platform independent

python program

windows os linux os mac os

portability

we can move one place to another place easily


mobile number po
Dynamcially Typed

we are not required to declare data type in python

but in c , java we have to declare datatype

data type is provided by the python automatically

a=10
print(type(a))

interpreted lanuguage
no need to compile a python program
interpreter is responsible for compilation

embedded

providing software code in hardwared devices called


embedded

in ece branch embedded systems subject

ac we will have a display board


for washing machine we will have a display board
remote control

identifiers
in my class 10 students are there how I will
identify them by using their name
like shiva, pavan,ravi

so a name in python program is called identifier

we have a small kid in our house


we will conduct naming ceremony
we have to keep some name
we will chose
god name
goddess name

grandfather name
grandmother name
ancestors name

if you are a very modern person we will search


in the google and select some name

the same way we want to create a name in our python


program

we have to follow some rules


we have to follow 5 rules

1.A name in Python Program is called as identifier

2.
The only allowed Characters in Python identifers are
alphabet Symbols, digits, and UnderScore.

cash=10
ca$h=10 invalid
ca_sh=10 valid
Python Identifiers Cannot start with a digit
total123=500
123total=500

Python Identifiers are Case Sensitive

total=30
>>> Total=40
>>> TOTAL=50
>>> print(total)
30
>>> print(Total)
40
>>> print(TOTAL)
50
>>>
There is no length for python identifiers

afbdfdfdsfdsfsdfdsfsdfsdfsdfsdfsdfsdfsdfsdfsdfdsfsdfdsfdsf
dsfdsfsdfdsfdsfsdfsdfsdfsdfsdfdsfsdfsdfsdfsdfsdfdsfdsfdsfd
sfdsfdsfsdfsdfdsfsdfsdfdsfsdfdsfsdfsdfsdfsdfsdfdsfdsfsdfds
fdsfsdfsdfsda=10
>>>
print(afbdfdfdsfdsfsdfdsfsdfsdfsdfsdfsdfsdfsdfsdfsdfdsfsdf
dsfdsfdsfdsfsdfdsfdsfsdfsdfsdfsdfsdfdsfsdfsdfsdfsdfsdfdsfd
sfdsfdsfdsfdsfsdfsdfdsfsdfsdfdsfsdfdsfsdfsdfsdfsdfsdfdsfds
fsdfdsfdsfsdfsdfsda)

We cannot use Reserved Words as Identifers


if=10

if=10
SyntaxError: invalid syntax
>>> for=30
SyntaxError: invalid syntax
>>> else=50
SyntaxError: invalid syntax

Data types

5 datatypes

[Link]
[Link]
[Link]
[Link]
[Link]

type(x)
id(x)

int:
what is int datat types

the value without decimal point

c language
short int--->-32768 to 32767
long int

no
every thing is int only
how much long it is int only

float

some times my requirement is I want to represent the


number in decimal points

dollar price
75.68
petrol price
95.67
so for this purpose we will use float data type

f=1.234

so we have to represent a number with decimal point we


will go for float data type

in mathematics we will see like this

1.2 e3
1.2*(10 power 3)
1200

f=1.2e3
>>> print(f)
1200.0

f=3.2e3
print(f)

Complex
we have heard in college days

[Link] calculus
[Link] numbers

in c, c++,java there is no separate complex data type

but in python yes it is available

the format of complex number is

a+bj
a is the real part
b is the imaginary part
j is fixed value
j2=-1
j=√-1
>

but in normal mathematics

a+ib

c=10+20j
>>> type(c)
<class 'complex'>
>>> c=5+6j
>>> type(c)
<class 'complex'>

c=10+20i---->error

can we use decimal numbers for a,b values


c=10.6+20.5j
>>> type(c)
<class 'complex'>

[Link]
[Link]

>>> c=10.6+20.5j
>>> type(c)
<class 'complex'>
>>> [Link]
10.6
>>> [Link]
20.5
>>>

bool (boolean)data type

what is the meaning of boolean

boolean means True or False

we will use boolean to represent True or False values

True is internally treated as 1


False is internally treated as 0

b=True
>>> type(b)
<class 'bool'>
>>>
a=False
>>> type(a)
<class 'bool'>

>>> True+True
2
>>> True+False
1
>>> False+False
0
>>> False+True
1
>>>

String data type

a sequence of characters

s=apple
s='apple'
s="apple"

which one is valid?

In python we can use either single quote or double quote


both are valid

there is no char data type in python

even single char is also treated as string


dfdfdfdffdsf
indexing is available for string

s=a p p l e

s[0]

arthimetic operators

The first category of operators is arithmetic operators

from child hood we are seeing there are 5 arthimetic


operators

but in python there are 6 arthimetic operators

+,-,*,/,//,**

//--->floor division
**-->exponential operator

2+3
5
>>> 5-3
2
>>> 4/2
2.0
>>>
if we use division operator(/) we will always provide result
in floating point only

if I want int as the result

I will go for
//--->floor division

4//2
2
>>>

**-->exponential operator

2**3
8
>>>

Relation operators are of 5 types

>,>=,<,<,==

The return type of the relation operators is always a


boolean value

5>3
True
>>> 5<3
False
5==5
True
>>>

Logical Operator

3 types
AND
OR
NOT

>>> True and True


True
>>> True and False
False
>>> False and True
False
>>> False and False
False
>>>

OR
>>> True or True
True
>>> True or False
True
>>> False or True
True
>>> False or False
False
>>>

>>> not True


False
>>> not False
True
>>>

You might also like