0% found this document useful (0 votes)
14 views2 pages

Python Basics: Operators and Data Types

The document provides an overview of Python basics, including types of operators (arithmetic, relational, logical), variables, identifiers, literals, keywords, and data types. It also includes sample code for finding the largest number among two or three integers and emphasizes the use of the BODMAS rule for arithmetic operations. Key concepts such as the definition of variables and reserved keywords are highlighted to aid understanding of Python programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views2 pages

Python Basics: Operators and Data Types

The document provides an overview of Python basics, including types of operators (arithmetic, relational, logical), variables, identifiers, literals, keywords, and data types. It also includes sample code for finding the largest number among two or three integers and emphasizes the use of the BODMAS rule for arithmetic operations. Key concepts such as the definition of variables and reserved keywords are highlighted to aid understanding of Python programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Basics

Operator a special character which acts between two operands

Different types of operator

1. Arithmatic operator
a. +, -, *, /, //, **, %
2. Relational operator
a. >, <, <=, >=, !=
3. Logical operator
a. And (both)
b. Or (either)
c. Not (reverse)

Variable It’s a location in the RAM(main memory which hold some data for our program

Identifier Which identifies a variable or Literals in a program

Literal The values are known as literal

Example: a = 10

In the above a is a variable, = is a operator, 10 is a literal

Keyword The Reserved word which is used for python’s internal usage we can not use as an
Identifier

Example : is, for, if, int, float, double, list, tuple, dictionary…..etc

Data Types:

1. Number
a. Int
b. Float
c. double
2. String
3. List
4. Tuple
5. Dictionary

 WAP to find the biggest number among two integers

A = int(input(‘Enter the value for A’)


B = int(input(‘Enter the value for B’)
if A>B:
print(‘ A is big’)
else:
print (‘B is big’)
 WAP to find the biggest number among three integers

a = int(input(‘Enter the value for a’)


b = int(input(‘Enter the value for b’)
c = int(input(‘Enter the value for c’)
If (a>b) and (a>c):

print(‘a is big’)

Elif (B>C):

print(‘b is big’)

Else

print(‘c is big’)

Predict the out put

2+3*3

Answer 11

Use BODMAS rule

You might also like