Numeric Literals
• Numeric values can be of three types -
– int (signed integers)
– float ( floating point real value)
– complex (complex numbers)
Boolean Literals
• It can contain either of only two values – True or False
A= True
B=False
Special Literals
None, which means nothing (no value).
X = None
Operators
An Operator is a symbol that triggers some action when
applied to an identifier(s) / operand(s)
example :
c=a+b
Here ‘=‘ a nd ‘+ ’ a re o p e ra to rs. a, b, c are operands
that are acted upon by operators.
Types of Operators
Operator Types
Unary
Binary
Types of Operators
Python supports following types of operators
– Unary Operators
• Unary plus (+)
• Unary Minus (-)
– Binary Operators
• Arithmetic operator (+, -, *, /, %, **, //)
• Relational Operator(<, >, <=, >=, ==, != )
• Logical Operator (and, or)
• Assigment Operator (=, /=, +=, -=, *=, %=, **=, //=)
Punctuators
• In Python, punctuators are used to construct the
program and to make balance between instructions
and statements. Python has following Punctuators -
‘, ”, #, \, (, ), [, ], {, }, @. ,, :, .. `, =
The print() function
Used to display a message or the value of an identifier
Syntax:
>>>print(“Python is Fun”)
The above function will display “Python is Fun” on the shell.
Print Statement Examples
Statement Output
print("Hello") Hello
print(10*2.5) 25.0
print("I" + "love" + "my" +"country") Ilovemycountry
print("I'm", 16, "years old") I'm 16 years old
In the next class, we would talk about variables, operators and taking user input.