Python Basic Day 1: Arithmetic Operators
As Arithmetic operators are basic operators those are used to perform basic mathematical works like :
+ (Addition)
– (Substraction)
* (Multiplication)
/ (Division)
% (Modulus)
Example for the Basic Python Program is :
#To Print Any Value print() is used
# # is used to Comment the Line
print("Hello")
print(3)
print(4.5)
#Python does not need Explicite Declaration of variable
roll_no=3
name="XYZ";
per=98.89
print("Roll No :",roll_no,"\nName of the Student :",name,"\nPercentage :",per)
#Arithmetic Operations + , - , * /, %
a=90
b=91
c=a+b #181
print("Total of ",a," and ",b," is ",c)
a="90"
b="91"
c=a+b #9091
print("Total if ",a," and ",b, " is ",c)
c= int(a)+ int(b) #181
print("Total if ",a," and ",b, " is ",c)
#In Conversation if input is not proper integer then Error will be gerenated
a=90
b=8
c=a/b
print("C is ",c) #11.25
c=a % b
print("C is ",c) #2
c=a*b
print("C is ",c) #720
c=a-b
print("C is ",c) #82
Output of the above Basic Program in Python will be like
Hello
3
4.5
Roll No : 3
Name of the Student : XYZ
Percentage : 98.89
Total of 90 and 91 is 181
Total if 90 and 91 is 9091
Total if 90 and 91 is 181
C is 11.25
C is 2