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

ANISHA DHAR - Assignment

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)
19 views2 pages

ANISHA DHAR - Assignment

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
You are on page 1/ 2

assignment

October 15, 2024

Write a program to find Area of circle , square , rectangle.


[1]: import math

def calculate_area():
print("Choose a shape to calculate the area:")
print("1. Circle")
print("2. Square")
print("3. Rectangle")

choice = input("Enter the number corresponding to your choice (1/2/3): ")

if choice == "1":
radius = float(input("Enter the radius of the circle: "))
area = math.pi * radius ** 2
print(f"The area of the circle is: {area:.2f}")

elif choice == "2":


side = float(input("Enter the side length of the square: "))
area = side ** 2
print(f"The area of the square is: {area:.2f}")

elif choice == "3":


length = float(input("Enter the length of the rectangle: "))
width = float(input("Enter the breadth of the rectangle: "))
area = length * breadth
print(f"The area of the rectangle is: {area:.2f}")
else:
print("Invalid choice. Please enter 1, 2, or 3.")
calculate_area()

Choose a shape to calculate the area:


1. Circle
2. Square
3. Rectangle
Enter the number corresponding to your choice (1/2/3): 1
Enter the radius of the circle: 16
The area of the circle is: 804.25

1
Find Gravitational force of any object.(F=mg)

[2]: def gravitational_force():


mass = float(input("Enter the mass of the object (in kg): "))
gravity = float(input("Enter the gravitational acceleration (in m/s^2,␣
↪default is 9.8): ") or 9.8)

force = mass * gravity


print(f"The gravitational force on the object is: {force:.2f} N")
gravitational_force()

Enter the mass of the object (in kg): 50


Enter the gravitational acceleration (in m/s^2, default is 9.8): 7.2
The gravitational force on the object is: 360.00 N
**Convert input temperature from Celsius to Fahrenheit(F=T*1.8+32)**

[3]: def temp():


celsius = float(input("Enter the temperature in Celsius: "))
fahrenheit = celsius * 1.8 + 32
print(f"The temperature in Fahrenheit is: {fahrenheit:.2f} °F")
temp()

Enter the temperature in Celsius: 36


The temperature in Fahrenheit is: 96.80 °F
Calculate SI=PxRxT
[4]: def simpleinterest():

principal = float(input("Enter the principal amount (P): "))


rate = float(input("Enter the annual interest rate (R) in percentage: "))
time = float(input("Enter the time (T) in years: "))
rate_decimal = rate / 100
simple_interest = principal * rate_decimal * time
print(f"The Simple Interest is: {simple_interest:.2f}")

simpleinterest()

Enter the principal amount (P): 50000


Enter the annual interest rate (R) in percentage: 15
Enter the time (T) in years: 3
The Simple Interest is: 22500.00

[ ]:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy