0% found this document useful (0 votes)
45 views

Python by Ranga

This document provides an overview of programming with Python. It discusses why Python is useful for programming when common data needs a custom application. It also lists some of Python's advantages over other languages like C#, Java, Perl, and R. Finally, it covers Python concepts like identifiers, keywords, data types, operators, strings, importing modules, user input, and popular Python libraries.

Uploaded by

renuka l
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

Python by Ranga

This document provides an overview of programming with Python. It discusses why Python is useful for programming when common data needs a custom application. It also lists some of Python's advantages over other languages like C#, Java, Perl, and R. Finally, it covers Python concepts like identifiers, keywords, data types, operators, strings, importing modules, user input, and popular Python libraries.

Uploaded by

renuka l
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 64

PROGRAMMING WITH

PYTHON
We may be thinking then why we need to learn

Some data simply isn’t common enough to have attracted the attention
Of a programmer, or we may need the data in a format that no application
currently Supports, so you don’t have any way to tell the computer about it
unless your create a Custom application to do it O
D
T H
E N
M R TI S O
O O A S
N
LI C CE
P P AC SE
A O HO
T T
THE SAME
PROCEDURE IF I
FOLLOW WILL I GET
THE MODEL IN REAL?
https://www.tiobe.com/tiobe-index/

https://spectrum.ieee.org/computing/softwa
re/the-top-programming-languages-2019
https://techrapidly.com/top-10-best-
programming-languages-learn-2019
https://www.alice.o http://www.fnal.gov/ http://go.com/ https://www.ny
rg/get-alice/alice- se.com/index
3/

https://www.youtube.com/
https://www.google.com/
https://www.python.org/about/apps/
LANGUAGES PYTHON HAS THESE ADVANTAGES

C# Significantly easier to learn


Smaller (more concise) code
Supported fully as open source
Better Multiplatform support
Multiple development environments
Easier to extend suing Java and C/C++
Enhanced Scientific and Engineering support

JAVA Significantly easier to learn


Smaller (more concise) code
Enhanced Variables
Faster development times
PERL Simple to learn, Easier to read, protection for
data , Better Java Integration

R Simple to learn, Easy debugging, Greater


flexibility, productivity and code readability
causes an compilation error
Python identifier is a name used to identify a
variable, function, class, module or other
object.
Rules to define Identifiers in python:
1.Alphabet symbol(both upper& lower case)
2.Digits(0 to 9)
3.Underscore(_)

Identifier should not start with Digit


Total123=10 (right)
123total=10 (wrong)

total=10
TOTAL=10 (Identifiers are
case sensitive)

If=20 ( it is a reserved word )


Exercise
• 123total x
If identifier starts with
• total123 ✓
• java2share _ = private
__ =strongly private

__main__ =language
• Ca$h x specific variable
• _abc_abc_

• Def
• Pass
• True • Elif • Try • Global
• False • While • Except • Nonlocal
• None • For • Finally • Lambda
• And • Break • Raise • Del
• Or • Continue • Assert
• Not • Return • Import
• Is • In • From
• If • Yield • As
• else • with • class
Note

• All reserved word contains only alphabets


• True, False, None start with capitals

• To see all keywords


• Import keywords
• Keyword.kwlist
DATA TYPES
• INT (1,2,3..) • LIST (group of values)
• FLOAT (1.1,) • TUPLE (list of values)
• COMPLEX (2+3j) • SET(list of values with
• BOOL(true /false) out duplicate)
• STR (string) • FROZEN SET(list of
• BYTES (a group of byte values with out duplicate
values) which can’t modify)
• BYTEARRAY(a group of • DICT(dictionary)
byte values) • NONE(none)
• RANGE(range of numbers
• LIST=square braces[ ]
• Tuple=round braces()
• Set= { }
• Dictionary=curly braces
SET, DICTIONARY
operators
• Addition (+)
• Subtraction(-)
• Multiplication(*)
• Division(/)
• Integer Division/floored quotient(//)
• Modulus/remainder (%)
• Exponent(**)
Operators examples
• 2+2=4 **
• 5-2=3 %
• 3*5=15 //
• 22/8=2 /
• 22%8=6 *
• 2**3=8 -
+
2+3*6
• Python will take from right to left
• First 3*6=18
• Then +2
• =20
• If the same function is given in this format
• (2+3)*6=30
• Python accepts single ('), double (") and
triple (''' or """) quotes to denote string
• word = 'word'
• sentence = "This is a sentence."
• paragraph = """This is a paragraph. It is
made up of multiple lines and sentences."""
• Import datetime
• Print(datetime.datetime.now())
Example :1
• name=input(“what is your name”)
• Print(“hi”+ name)

• ASK YOUR FRIEND TWO QUESTIONS


• PERSONS NAME & FAVOURITE COLOR
• AND PRINTA MESSAGE “NAME LIKES
BLUE COLOR
•Numpy.
•Scipy.
•Scikit-learn.
•Theano.
•TensorFlow.
•Keras.
•PyTorch.
•Pandas.
•tkinter

You might also like