2) Unit 1
2) Unit 1
Language &
Features
What is Python?
Modes of Instruction
Errors in
Python
1. SYNTAX ERROR
2. RUN TIME ERROR
SYNTAX ERRORS
RUNTIME ERRORS
About Python Program
Types of Comments
2. Docstring Comments
Identifiers in Python
RULES FOR IDENTIFIERS
KEYWORDS
Various Keywords in
Python
VARIABLES
Chained
Assignment
Operators
Operators in Python
Assignment statements in
Python
Number
String
List
Tuple
Set
Dictionary
Contd….
The same variable in Python can refer to data of
different data types at different times.
Thus, variables in Python are not strongly typed,
implying that you don't have to explicitly declare
the data type of a variable when creating it.
Example:
Numbers
There are 3 different categories of Numbers in
Python.
Int
Float
Complex
Int:
Float:
Complex:
List
Sets in Python
Contd…
Tuple
Allows duplicate values:
To find Tuple length:
Dictionary
Example:
Example:
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict["brand"])
Input and Output
Statements
Example:
Basics of Python
Programming
Arithmetic Operators
Python Booleans :
Booleans represent one of two
values: True or False.
You can evaluate any expression in Python, and
get one of two answers, True or False.
Print a message based on whether the
condition is True or False:
Evaluate Values and Variables