Lecture1 Py
Lecture1 Py
BCA Department
Institute of Engineering & Management
Automation?
The process of replacing a manual step with one that happens manually
Programmi
ng
Translator
(Compiler /
Interpreter)
Machin Cod
e e
Python is
• A general purpose scripting
language;
• A cross-platform compatible
language;
• A beginner-friendly language.
Python is not
platform-specific / OS-specific scripting language;
Misspellings
Incorrect indentations
Missing or incorrect key characters:
Bracket types - ( curved ), [ square ], { curly }
Quote types - "straight-double" or 'straight-single', “curly-double” or ‘curly-single’
Block introduction characters, like colons - :
Data type mismatches
Missing, incorrectly used, or misplaced Python reserved words
Using the wrong case (uppercase/lowercase) - Python is a case-sensitive
language
Common semantic errors
Creating functional code, but getting unintentional output
name =
"Deepika" age
= 23
price = 25.99
Memory
name =
"Deepika" age
= 23
price = 25.99
Rules for
Identifiers
Data Types
Integer
s
String
Float
Boolea
n None
Data Types
Keywords
Keywords are reserved words in
python.
*False should be
uppercase
Print Sum
Comments in
Python
# Single Line
Comment
"""
Multi Line
Comment
"""
Types of
Operators
An operator is a symbol that performs a certain operation
between operands.
Arithmetic Operators ( + , - , * , / , % , * * )
= , *= , /= , %= , **= )
PEDMAS
The order of operations are to be calculated from left to right in the following
order:
Parentheses ( ), { }, [ ]
Exponents xy (x**y)
a, b = 1,
2.0
sum = a + b
#error
a, b = 1,
"2"
sum = a + b
Type Casting
a, b = 1,
"2"
c = int(b)
sum = a + c
Type Casting
Input in Python
input( ) statement is used to accept values (using keyboard)
from user