EX.
NO:1
PROGRAM USING VARIABLES, CONSTANTS, I/O
STATEMENTS IN PYTHON
DATE:
AIM:
To write a Python program to find Area of Circle and Perimeter of a Circle Using Variables,
Constants, I/O Statement.
ALGORITHM:
[Link]
Step 1: Start the Execution.
Step 2: Assign PI constant Value to 3.14.
Step 3: Stop the Execution.
[Link]
Step 1: Start the Execution.
Step 2: Import [Link]
Step 3: Read radius value from user input.
Step 4: Assign area=constant value PI * radius * radius.
Step 5: Calculate perimeter = 2* constant PI * radius.
Step 6: Print Area Value.
Step 7: Print Perimeter Value.
Step 8: Stop the Execution.
SHANMUGA INDUSTRIES ARTS AND SCIENCE COLLEGE-TIRUVANNAMALAI PYTHON PROGRAMMING LAB Page No.
[Link]
PI=3.14
[Link]
import constant
print("PROGRAM USING VARIABLES, CONSTANTS, I/O STATEMENTS IN
PYTHON")
print("************************************************************")
print("INPUT")
print("--------")
radius = float (input("Enter Radius Value ="))
area = round([Link]*radius*radius,2)
perimeter=round(2*[Link]*radius,2)
print("OUTPUT")
print("======")
print("Area of Circle=",area)
print("Perimeter of Circle=",perimeter)
SHANMUGA INDUSTRIES ARTS AND SCIENCE COLLEGE-TIRUVANNAMALAI PYTHON PROGRAMMING LAB Page No.
PROGRAM USING VARIABLES, CONSTANTS, I/O STATEMENTS IN PYTHON
**********************************************************************
INPUT
Enter Radius Value =5
OUTPUT
======
Area of Circle= 78.5
Perimeter of Circle= 31.4
Result: Thus the above program using Variables, Constants, I/O Statements in Python executed
successfully.
SHANMUGA INDUSTRIES ARTS AND SCIENCE COLLEGE-TIRUVANNAMALAI PYTHON PROGRAMMING LAB Page No.
[Link]
PROGRAM USING OPERATORS IN PYTHON
DATE:
AIM:
To write a program for Arithmetic and comparison operations using Operators in Python.
ALGORITHM:
Step 1: Start the Execution.
Step 2: Read a value.
Step 3: Read b value.
Step 4: Calculate addition of a and b using + operator and Print a + b value.
Step 5: Calculate subtraction of a and b using - operator and Print a - b value.
Step 6: Calculate multiplication of a and b using * operator and Print a * b value.
Step 7: Calculate division of a and b using / operator and Print a / b value.
Step 8: Calculate reminder of a and b using % operator and Print a % b value.
Step 9: Calculate Exponent of a and b using ** operator and Print a ** b value.
Step 10: Check floor division of a and b using || operator and Print a || b value.
Step 11: Check whether a and b is equal using == operator and Print a == b value.
Step 12: Check whether a and b is not equal using != operator and Print a != b value.
Step 13: Check whether a is Greater than b using > operator and Print a > b value.
Step 14: Check whether a is Less than b using < operator and Print a < b value.
Step 15: Stop the Execution.
SHANMUGA INDUSTRIES ARTS AND SCIENCE COLLEGE-TIRUVANNAMALAI PYTHON PROGRAMMING LAB Page No.
[Link]
print("PROGRAM USING OPERATORS IN PYTHON ")
print("****************************************")
print("INPUT")
print("--------")
a=int(input("Enter Value for a :"))
b=int(input("Enter Value for b :"))
print("OUTPUT")
print("======")
print("Addition of a and b :",a+b)
print("Subtraction of a and b :",a-b)
print("Multiplication of a and b :",a*b)
print("Division of a and b :",round(a/b,2))
print("Reminder of a division b :",a%b)
print("Exponent of a and b :",a**b)
print("Floor Division of a and b :",a//b)
print("Check Whether a equal to b:",a==b)
print("Check Whether a not equal to b:",a!=b)
print("Check Whether a is Greater than b:",a>b)
print("Check Whether a is Less than b:",a<b)
SHANMUGA INDUSTRIES ARTS AND SCIENCE COLLEGE-TIRUVANNAMALAI PYTHON PROGRAMMING LAB Page No.
PROGRAM USING OPERATORS IN PYTHON
****************************************
INPUT
--------
Enter Value for a :5
Enter Value for b :3
OUTPUT
=======
Addition of a and b : 8
Subtraction of a and b : 2
Multiplication of a and b : 15
Division of a and b : 1.67
Reminder of a division b : 2
Exponent of a and b : 125
Floor Division of a and b : 1
Check Whether a equal to b: False
Check Whether a not equal to b: True
Check Whether a is Greater than b: True
Check Whether a is Less than b: False
Result: Thus the above program using Arithmetic and Comparison Operator program in Python
executed successfully.
SHANMUGA INDUSTRIES ARTS AND SCIENCE COLLEGE-TIRUVANNAMALAI PYTHON PROGRAMMING LAB Page No.