SlideShare a Scribd company logo
Python Programming
UNIT 1 : SYLLABUS
• Conceptual introduction: topics in computer science, algorithms;
• Modern computer systems: hardware architecture, data
representation in computers, software and operating system;
• Installing Python; basic syntax, interactive shell, editing, saving, and
running a script.
• The concept of data types; variables, assignments; immutable
variables; numerical types;
• arithmetic operators and expressions; comments in the program;
understanding error messages;
Variables, Assignments,
immutable variables
Numerical types
The concept of data
types
The concept of data types
• A data type consists of a set of values and a set of operations that
can be performed on those values.
• A literal is the way a value of a data type looks to a programmer.
The concept of data types
The concept of data types
String Literals:
In Python, a string literal is a
sequence of characters
enclosed in single or double
quotation marks.
Empty String
Empty String
The concept of data types
String Literals:
In Python, a string literal is a
sequence of characters
enclosed in single or double
quotation marks.
Single Quote inside the String
The concept of data types
String Literals:
In Python, a string literal is a
sequence of characters
enclosed in single or double
quotation marks.
Three Quotes for
Multiple line string
The concept of data types
String Literals:
In Python, a string literal is a
sequence of characters
enclosed in single or double
quotation marks. n Embedded
The concept of data types
Escape Sequences:
• The newline character n is
called an escape sequence.
• Escape sequences are the
way Python expresses
special characters, such as
the tab, the newline, and the
backspace (delete key), as
literals.
The concept of data types
String Concatenation:
“Hello” + “world”  Hello
world
a = “welcome”
b = “to”
c = “python”
d = a + b + c  “Welcome to
python”
+ is used for
combining
The concept of data types
String Repeating:
“Hi ” * 3  “Hi Hi Hi”
a = “hello ”
b = a*2  “hello hello”
* is used for
combining
Variables, Assignments,
immutable variables
Numerical types
The concept of data
types
if
import
in
is
lambda
nonlocal
with
yield
except
finally
for
from
global
raise
try
while
class
continue
def
del
elif
pass
else
return
and
as
assert
async
await
break
not
or
35
key
words
Started
with
capitals
True
False
None
Variables, Assignments, immutable variables
Variables, Assignments, immutable variables
Variable:
• In Python, a variable is a
reserved memory location
used to store values.
• Python has no command for
declaring a variable. A variable
is created the moment a value
is assigned to it.
• The equal to (=) operator is
used to assign value to a
variable. (Assignment
Operator).
• If we want to store the age of a
person, we should not name
the variable as x, or y or a, or i.
• we should name the variable
as age.
Variables, Assignments, immutable variables
• Use letters
• Use
numbers
with letters
• Use ‘_’ for
long names
a = 5  a variable
A = 6  a variable
(note : A & a are different
variables)
A 1 = 10  a variable
my_name = “Raja”  a
variable
Variables, Assignments, immutable variables
2a = 100  syntax error
a2 = 100  is a variable
if = 5  is a syntax error
If = 5  If is a variable
True = 6  is a syntax error
true = 6  true is a variable
• Don’t start
with
number
• Don’t use
keywords
as variable
names
Variables, Assignments, immutable variables
Multiple Assignment:
• Python allows you to assign a
single value to several
variables simultaneously.
• number1 = number2 = number3 =
100
• This is called chained
assignment.
• We can also assign multiple
objects to multiple variables;
this is called multiple
assignment.
• value1, value2, value3 = 1, 2.5, "Ram“
Variables, Assignments, immutable variables
• Associating a value with a
variable using the assignment
operator (=) is called as
Binding.
Value1 = Value2 =100
Value1 = “Hello”
Print(Value1)  “Hello” not 100
• We cannot use Python variables
without assigning any value.
• If we try to use a variable
without assigning any value
then, Python interpreter shows
error like "name is not defined".
Variables, Assignments, immutable variables
• Most python objects (Booleans,
integers, floats, strings, and tuples)
are immutable.
• This means that after you create the
object and assign some value to it,
you can't modify that value.
• Using the expressions, a = 1 and then
a = 2.
• The object with value 1 still exists in
memory, but you’ve lost the binding
to it. (can’t access it anymore)
Variables, Assignments,
immutable variables
Numerical types
The concept of data
types
Numerical types
Numerical types
Integers:
• This value is represented by int class.
• It contains positive or negative whole
numbers (without fraction or
decimal).
• In Python there is no limit to how
long an integer value can be..
Ex : a = 5, b = 6
type(a)  <class 'int'>
type(b)  <class 'int'>
Numerical types
Float:
• This value is represented by float
class.
• It is a real number with floating point
representation. It is specified by a
decimal point.
• Optionally, the character e or E
followed by a positive or negative
integer may be appended to specify
scientific notation.
Ex : a = 5.5, b = 6.0
type(a)  <class ‘float'>
type(b)  <class ‘float'>
Numerical types
Complex Numbers:
• Complex number is
represented by complex class.
• It is specified as
(real part) + (imaginary part)j.
Ex : a = 2 + 6j, b = - 8 + 2j
type(a)  <class ‘complex'>
type(b)  <class ‘complex'>
Numerical types
Character set:
• All data and instructions in a
program are translated to binary
numbers before being run on a real
computer.
• To support this translation, the
characters in a string each map to an
integer value. This mapping is
defined in character sets, among
them the ASCII set and the
• UNICODE uses between 8 and 32
bits per character, so it can represent
characters from languages from all
around the world.
• ASCII represents lowercase letters (a-
z), uppercase letters (A-Z), digits (0–
9) and symbols
Numerical types
• ASCII Code of Character
“R” is 82
• Row num is 8
• Column num is 2
Numerical types
• Python’s ord and chr functions
convert characters to their
numeric ASCII codes and back
again, respectively.
Variables, Assignments,
immutable variables
Numerical types
The concept of data
types
Boolean types
Boolean:
• Data type with one of the two
built-in values, True or False.
• Boolean objects that are equal
to True or False.
• Note: True and False with
capital ‘T’ and ‘F’ are valid
Booleans.
Ex : a = True , b = False
type(a)  <class ‘bool'>
type(b)  <class ‘bool’>
Ex : a = “true” b = “false”
type(a)  <class ‘str'>
type(b)  <class ‘str’>
UNIT 1 : SYLLABUS
• Conceptual introduction: topics in computer science, algorithms;
• Modern computer systems: hardware architecture, data
representation in computers, software and operating system;
• Installing Python; basic syntax, interactive shell, editing, saving, and
running a script.
• The concept of data types; variables, assignments; immutable
variables; numerical types;
• arithmetic operators and expressions; comments in the program;
understanding error messages;

More Related Content

What's hot

Numeric Data types in Python
Numeric Data types in PythonNumeric Data types in Python
Numeric Data types in Python
jyostna bodapati
 
Data types in python lecture (2)
Data types in python lecture (2)Data types in python lecture (2)
Data types in python lecture (2)
Ali ٍSattar
 
Java tutorial part 3
Java tutorial part 3Java tutorial part 3
Java tutorial part 3
Mumbai Academisc
 
Java basic datatypes
Java basic datatypesJava basic datatypes
Java basic datatypes
Soba Arjun
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
Ankita Totala
 
ITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in java
Atul Sehdev
 
+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II Notes+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II Notes
Andrew Raj
 
Python-03| Data types
Python-03| Data typesPython-03| Data types
Python-03| Data types
Mohd Sajjad
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
Spotle.ai
 
#_ varible function
#_ varible function #_ varible function
#_ varible function
abdullah al mahamud rosi
 
Data types in python
Data types in pythonData types in python
Data types in python
RaginiJain21
 
Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and types
Daman Toor
 
Variable
VariableVariable
Python Programming - V. Sequences (List and Tuples) and Dictionaries
Python Programming - V. Sequences (List and Tuples) and DictionariesPython Programming - V. Sequences (List and Tuples) and Dictionaries
Python Programming - V. Sequences (List and Tuples) and Dictionaries
Ranel Padon
 
Data Handling
Data HandlingData Handling
Data Handling
Praveen M Jigajinni
 
Datatype
DatatypeDatatype
Datatype
baran19901990
 
Quick Scala
Quick ScalaQuick Scala
Quick Scala
Puneet Kumar
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutability
Mohd Sajjad
 

What's hot (20)

Numeric Data types in Python
Numeric Data types in PythonNumeric Data types in Python
Numeric Data types in Python
 
Data types in python lecture (2)
Data types in python lecture (2)Data types in python lecture (2)
Data types in python lecture (2)
 
Java tutorial part 3
Java tutorial part 3Java tutorial part 3
Java tutorial part 3
 
Java basic datatypes
Java basic datatypesJava basic datatypes
Java basic datatypes
 
Data Types & Variables in JAVA
Data Types & Variables in JAVAData Types & Variables in JAVA
Data Types & Variables in JAVA
 
ITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in javaITFT-Constants, variables and data types in java
ITFT-Constants, variables and data types in java
 
+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II Notes+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II Notes
 
Python-03| Data types
Python-03| Data typesPython-03| Data types
Python-03| Data types
 
Java Data Types
Java Data TypesJava Data Types
Java Data Types
 
#_ varible function
#_ varible function #_ varible function
#_ varible function
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and types
 
Variable
VariableVariable
Variable
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Python Programming - V. Sequences (List and Tuples) and Dictionaries
Python Programming - V. Sequences (List and Tuples) and DictionariesPython Programming - V. Sequences (List and Tuples) and Dictionaries
Python Programming - V. Sequences (List and Tuples) and Dictionaries
 
Data Handling
Data HandlingData Handling
Data Handling
 
wrapper classes
wrapper classeswrapper classes
wrapper classes
 
Datatype
DatatypeDatatype
Datatype
 
Quick Scala
Quick ScalaQuick Scala
Quick Scala
 
Python-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutabilityPython-04| Fundamental data types vs immutability
Python-04| Fundamental data types vs immutability
 

Similar to Python Programming | JNTUK | UNIT 1 | Lecture 4

2nd PUC Computer science chapter 5 review of c++
2nd PUC Computer science chapter 5   review of c++2nd PUC Computer science chapter 5   review of c++
2nd PUC Computer science chapter 5 review of c++
Aahwini Esware gowda
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
Tanishq Soni
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ayshwarya Baburam
 
Variables&DataTypes.pptx
Variables&DataTypes.pptxVariables&DataTypes.pptx
Variables&DataTypes.pptx
sanjanaMudduluru1
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.ppt
ThedronBerhanu
 
BASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their ownBASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their own
Nandini485510
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx
deivanayagamramachan
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTES
Rushikesh Kolhe
 
Java Datatypes
Java DatatypesJava Datatypes
Java Datatypes
Mayank Aggarwal
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
Raja Sekhar
 
python
pythonpython
python
ultragamer6
 
introduction to python
 introduction to python introduction to python
introduction to python
Jincy Nelson
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docx
theodorelove43763
 
Chapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptxChapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptx
lemonchoos
 
Python Programming
Python ProgrammingPython Programming
Python Programming
Saravanan T.M
 
Constants, Variables, and Data Types
Constants, Variables, and Data TypesConstants, Variables, and Data Types
Constants, Variables, and Data Types
Rokonuzzaman Rony
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
TamalSengupta8
 
computer science CLASS 11 AND 12 SYLLABUS.pdf
computer science CLASS 11 AND 12 SYLLABUS.pdfcomputer science CLASS 11 AND 12 SYLLABUS.pdf
computer science CLASS 11 AND 12 SYLLABUS.pdf
SomnathSaha63
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
Chariza Pladin
 

Similar to Python Programming | JNTUK | UNIT 1 | Lecture 4 (20)

2nd PUC Computer science chapter 5 review of c++
2nd PUC Computer science chapter 5   review of c++2nd PUC Computer science chapter 5   review of c++
2nd PUC Computer science chapter 5 review of c++
 
Literals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiersLiterals, primitive datatypes, variables, expressions, identifiers
Literals, primitive datatypes, variables, expressions, identifiers
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Variables&DataTypes.pptx
Variables&DataTypes.pptxVariables&DataTypes.pptx
Variables&DataTypes.pptx
 
chapter 5.ppt
chapter 5.pptchapter 5.ppt
chapter 5.ppt
 
BASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their ownBASICS OF PYTHON usefull for the student who would like to learn on their own
BASICS OF PYTHON usefull for the student who would like to learn on their own
 
2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx2. Values and Data types in Python.pptx
2. Values and Data types in Python.pptx
 
Programming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTESProgramming in Civil Engineering_UNIT 2_NOTES
Programming in Civil Engineering_UNIT 2_NOTES
 
Java Datatypes
Java DatatypesJava Datatypes
Java Datatypes
 
java Basic Programming Needs
java Basic Programming Needsjava Basic Programming Needs
java Basic Programming Needs
 
python
pythonpython
python
 
introduction to python
 introduction to python introduction to python
introduction to python
 
Data Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docxData Type is a basic classification which identifies.docx
Data Type is a basic classification which identifies.docx
 
Chapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptxChapter7-Introduction to Python.pptx
Chapter7-Introduction to Python.pptx
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 
Constants, Variables, and Data Types
Constants, Variables, and Data TypesConstants, Variables, and Data Types
Constants, Variables, and Data Types
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
computer science CLASS 11 AND 12 SYLLABUS.pdf
computer science CLASS 11 AND 12 SYLLABUS.pdfcomputer science CLASS 11 AND 12 SYLLABUS.pdf
computer science CLASS 11 AND 12 SYLLABUS.pdf
 
Java session3
Java session3Java session3
Java session3
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 

More from FabMinds

Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists | Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists |
FabMinds
 
Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings | Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings |
FabMinds
 
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration | Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study | Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions | Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
FabMinds
 
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion | Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
FabMinds
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
FabMinds
 
Internet connectivity
Internet connectivityInternet connectivity
Internet connectivity
FabMinds
 
Introduction for internet connectivity (IoT)
 Introduction for internet connectivity (IoT) Introduction for internet connectivity (IoT)
Introduction for internet connectivity (IoT)
FabMinds
 
web connectivity in IoT
web connectivity in IoTweb connectivity in IoT
web connectivity in IoT
FabMinds
 
message communication protocols in IoT
message communication protocols in IoTmessage communication protocols in IoT
message communication protocols in IoT
FabMinds
 
web communication protocols in IoT
web communication protocols in IoTweb communication protocols in IoT
web communication protocols in IoT
FabMinds
 
introduction for web connectivity (IoT)
introduction for web connectivity (IoT)introduction for web connectivity (IoT)
introduction for web connectivity (IoT)
FabMinds
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
FabMinds
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
FabMinds
 
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
FabMinds
 
Data enrichment
Data enrichmentData enrichment
Data enrichment
FabMinds
 
Communication technologies
Communication technologiesCommunication technologies
Communication technologies
FabMinds
 
M2M systems layers and designs standardizations
M2M systems layers and designs standardizationsM2M systems layers and designs standardizations
M2M systems layers and designs standardizations
FabMinds
 
Business models for business processes on IoT
Business models for business processes on IoTBusiness models for business processes on IoT
Business models for business processes on IoT
FabMinds
 

More from FabMinds (20)

Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists | Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Lists |
 
Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings | Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 3 | Strings |
 
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration | Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |
 
Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study | Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Case Study |
 
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions | Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
 
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion | Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
 
Internet connectivity
Internet connectivityInternet connectivity
Internet connectivity
 
Introduction for internet connectivity (IoT)
 Introduction for internet connectivity (IoT) Introduction for internet connectivity (IoT)
Introduction for internet connectivity (IoT)
 
web connectivity in IoT
web connectivity in IoTweb connectivity in IoT
web connectivity in IoT
 
message communication protocols in IoT
message communication protocols in IoTmessage communication protocols in IoT
message communication protocols in IoT
 
web communication protocols in IoT
web communication protocols in IoTweb communication protocols in IoT
web communication protocols in IoT
 
introduction for web connectivity (IoT)
introduction for web connectivity (IoT)introduction for web connectivity (IoT)
introduction for web connectivity (IoT)
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
 
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | FunctionsPython Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
 
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
 
Data enrichment
Data enrichmentData enrichment
Data enrichment
 
Communication technologies
Communication technologiesCommunication technologies
Communication technologies
 
M2M systems layers and designs standardizations
M2M systems layers and designs standardizationsM2M systems layers and designs standardizations
M2M systems layers and designs standardizations
 
Business models for business processes on IoT
Business models for business processes on IoTBusiness models for business processes on IoT
Business models for business processes on IoT
 

Recently uploaded

Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
christianmathematics
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

Python Programming | JNTUK | UNIT 1 | Lecture 4

  • 2. UNIT 1 : SYLLABUS • Conceptual introduction: topics in computer science, algorithms; • Modern computer systems: hardware architecture, data representation in computers, software and operating system; • Installing Python; basic syntax, interactive shell, editing, saving, and running a script. • The concept of data types; variables, assignments; immutable variables; numerical types; • arithmetic operators and expressions; comments in the program; understanding error messages;
  • 4. The concept of data types • A data type consists of a set of values and a set of operations that can be performed on those values. • A literal is the way a value of a data type looks to a programmer.
  • 5. The concept of data types
  • 6. The concept of data types String Literals: In Python, a string literal is a sequence of characters enclosed in single or double quotation marks. Empty String Empty String
  • 7. The concept of data types String Literals: In Python, a string literal is a sequence of characters enclosed in single or double quotation marks. Single Quote inside the String
  • 8. The concept of data types String Literals: In Python, a string literal is a sequence of characters enclosed in single or double quotation marks. Three Quotes for Multiple line string
  • 9. The concept of data types String Literals: In Python, a string literal is a sequence of characters enclosed in single or double quotation marks. n Embedded
  • 10. The concept of data types Escape Sequences: • The newline character n is called an escape sequence. • Escape sequences are the way Python expresses special characters, such as the tab, the newline, and the backspace (delete key), as literals.
  • 11. The concept of data types String Concatenation: “Hello” + “world”  Hello world a = “welcome” b = “to” c = “python” d = a + b + c  “Welcome to python” + is used for combining
  • 12. The concept of data types String Repeating: “Hi ” * 3  “Hi Hi Hi” a = “hello ” b = a*2  “hello hello” * is used for combining
  • 13. Variables, Assignments, immutable variables Numerical types The concept of data types
  • 15. Variables, Assignments, immutable variables Variable: • In Python, a variable is a reserved memory location used to store values. • Python has no command for declaring a variable. A variable is created the moment a value is assigned to it. • The equal to (=) operator is used to assign value to a variable. (Assignment Operator). • If we want to store the age of a person, we should not name the variable as x, or y or a, or i. • we should name the variable as age.
  • 16. Variables, Assignments, immutable variables • Use letters • Use numbers with letters • Use ‘_’ for long names a = 5  a variable A = 6  a variable (note : A & a are different variables) A 1 = 10  a variable my_name = “Raja”  a variable
  • 17. Variables, Assignments, immutable variables 2a = 100  syntax error a2 = 100  is a variable if = 5  is a syntax error If = 5  If is a variable True = 6  is a syntax error true = 6  true is a variable • Don’t start with number • Don’t use keywords as variable names
  • 18. Variables, Assignments, immutable variables Multiple Assignment: • Python allows you to assign a single value to several variables simultaneously. • number1 = number2 = number3 = 100 • This is called chained assignment. • We can also assign multiple objects to multiple variables; this is called multiple assignment. • value1, value2, value3 = 1, 2.5, "Ram“
  • 19. Variables, Assignments, immutable variables • Associating a value with a variable using the assignment operator (=) is called as Binding. Value1 = Value2 =100 Value1 = “Hello” Print(Value1)  “Hello” not 100 • We cannot use Python variables without assigning any value. • If we try to use a variable without assigning any value then, Python interpreter shows error like "name is not defined".
  • 20. Variables, Assignments, immutable variables • Most python objects (Booleans, integers, floats, strings, and tuples) are immutable. • This means that after you create the object and assign some value to it, you can't modify that value. • Using the expressions, a = 1 and then a = 2. • The object with value 1 still exists in memory, but you’ve lost the binding to it. (can’t access it anymore)
  • 21. Variables, Assignments, immutable variables Numerical types The concept of data types
  • 23. Numerical types Integers: • This value is represented by int class. • It contains positive or negative whole numbers (without fraction or decimal). • In Python there is no limit to how long an integer value can be.. Ex : a = 5, b = 6 type(a)  <class 'int'> type(b)  <class 'int'>
  • 24. Numerical types Float: • This value is represented by float class. • It is a real number with floating point representation. It is specified by a decimal point. • Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation. Ex : a = 5.5, b = 6.0 type(a)  <class ‘float'> type(b)  <class ‘float'>
  • 25. Numerical types Complex Numbers: • Complex number is represented by complex class. • It is specified as (real part) + (imaginary part)j. Ex : a = 2 + 6j, b = - 8 + 2j type(a)  <class ‘complex'> type(b)  <class ‘complex'>
  • 26. Numerical types Character set: • All data and instructions in a program are translated to binary numbers before being run on a real computer. • To support this translation, the characters in a string each map to an integer value. This mapping is defined in character sets, among them the ASCII set and the • UNICODE uses between 8 and 32 bits per character, so it can represent characters from languages from all around the world. • ASCII represents lowercase letters (a- z), uppercase letters (A-Z), digits (0– 9) and symbols
  • 27. Numerical types • ASCII Code of Character “R” is 82 • Row num is 8 • Column num is 2
  • 28. Numerical types • Python’s ord and chr functions convert characters to their numeric ASCII codes and back again, respectively.
  • 29. Variables, Assignments, immutable variables Numerical types The concept of data types
  • 30. Boolean types Boolean: • Data type with one of the two built-in values, True or False. • Boolean objects that are equal to True or False. • Note: True and False with capital ‘T’ and ‘F’ are valid Booleans. Ex : a = True , b = False type(a)  <class ‘bool'> type(b)  <class ‘bool’> Ex : a = “true” b = “false” type(a)  <class ‘str'> type(b)  <class ‘str’>
  • 31. UNIT 1 : SYLLABUS • Conceptual introduction: topics in computer science, algorithms; • Modern computer systems: hardware architecture, data representation in computers, software and operating system; • Installing Python; basic syntax, interactive shell, editing, saving, and running a script. • The concept of data types; variables, assignments; immutable variables; numerical types; • arithmetic operators and expressions; comments in the program; understanding error messages;