Python Practical Notes - Arithmetic Operators - Part 1
Python Practical Notes - Arithmetic Operators - Part 1
NOTES uwu
(ARITHMETIC
OPERATORS)
Basic operators:
print(5+6)
- ADDITION
print(6-5)
- SUBTRACTION
print(5*6)
- MULTIPLY
print(5**2)
-5 RAISED TO THE POWER 2
print(16/5)
- 16 DIVIDED BY 5
print(16//5)
- INTEGER VALUE OF 16 DIVIDED BY 5
print(16%5)
- REMAINDER OF 16 DIVIDED BY 5
SUCCESOR/PREDESSOR : ANY INTEGER
NUMBER
uwu = int(input("enter a number: "))
print("successor" , uwu + 1 )
print("predecessor" , uwu - 1 )
SUCCESSOR/PREDECESSOR : FIXED
NUMBER
x=5
print("successor" , x+1)
print("predecessor" , x-1)
HOW TO FIND AVERAGE? Any integer
value.
Science = int(input("Enter your marks of
sci:"))
SST = int(input("Enter your marks of sst:"))
English = int(input("Enter your marks of
eng:"))
Hindi = int(input("Enter your marks of
hindi:"))
Maths = int(input("Enter your marks of
math:"))
Total_Marks = Science + SST + English +
Hindi + Maths
print("Total Marks" , Total_Marks)
Average_of_marks = Total_Marks/5
print("Average of marks:" ,
Average_of_marks )
FOR FIXED VALUES –
Science = 40
SST = 20
English = 40
Hindi = 20
Maths = 30
Total_Marks = Science + SST + English +
Hindi + Maths
print("Total Marks" , Total_Marks)
Average_of_marks = Total_Marks/5
print("Average of marks:" ,
Average_of_marks )
WAP that accepts two integer variables
using input commands and displays its
difference.
Method 1 –
uwu = int(input("write a number: "))
lala = int(input("Write another number: "))
print("difference of these 2 numbers:" ,
uwu-lala )
Method 2 –
uwu = int(input("write a number: "))
lala = int(input("Write another number: "))
difference_of_numbers = uwu - lala
print("difference of these 2 numbers:" ,
difference_of_numbers )
WAP that accepts two integer variables
using input commands and finds the
reminder after the division.