0% found this document useful (0 votes)
4 views6 pages

Python Programs for Circle and Operators

The document outlines two Python programming exercises: one for calculating the area and perimeter of a circle using constants and I/O statements, and another for performing arithmetic and comparison operations using operators. Each exercise includes an algorithm, code snippets, example inputs, and outputs demonstrating successful execution. The programs are designed for a Python programming lab at Shanmuga Industries Arts and Science College.
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)
4 views6 pages

Python Programs for Circle and Operators

The document outlines two Python programming exercises: one for calculating the area and perimeter of a circle using constants and I/O statements, and another for performing arithmetic and comparison operations using operators. Each exercise includes an algorithm, code snippets, example inputs, and outputs demonstrating successful execution. The programs are designed for a Python programming lab at Shanmuga Industries Arts and Science College.
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

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.

You might also like