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

Chapter 2 - Python Beginning Part 2

The document discusses different types of literals in Python including numeric, boolean, and special literals. It then covers operator types such as unary, binary, and assignment operators. Finally, it discusses punctuators and provides examples of using the print function.

Uploaded by

Jahnavi Pathak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Chapter 2 - Python Beginning Part 2

The document discusses different types of literals in Python including numeric, boolean, and special literals. It then covers operator types such as unary, binary, and assignment operators. Finally, it discusses punctuators and provides examples of using the print function.

Uploaded by

Jahnavi Pathak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

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.

You might also like