0% found this document useful (0 votes)
4 views1 page

Avi Python Program

The document contains Python programs for various tasks: checking if a number is in a list, calculating the year someone will turn 100, and computing the volume and surface area of a cone. Each program includes user input prompts and relevant calculations. The solutions utilize basic Python functions and mathematical operations.

Uploaded by

tushars846528
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 views1 page

Avi Python Program

The document contains Python programs for various tasks: checking if a number is in a list, calculating the year someone will turn 100, and computing the volume and surface area of a cone. Each program includes user input prompts and relevant calculations. The solutions utilize basic Python functions and mathematical operations.

Uploaded by

tushars846528
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

Q4.

Write a program to compute distance between two points in python taking input
Q1. Write a program in python to read a list of numbers to check whether a particular from the user using python
element is present or not using membership operators.
Ans: Ans:
l = eval(input("Enter list: ")) import math
n = int(input("Enter number to search: "))
def distance(x1, y1, x2, y2):
if n in l: return [Link]((x2 - x1)**2 + (y2 - y1)**2)
print(n, "found at index", [Link](n))
else : x1 = float(input("Enter x-coordinate of the first point: "))
print(n, "not found in list") y1 = float(input("Enter y-coordinate of the first point: "))
x2 = float(input("Enter x-coordinate of the second point: "))
Q2. Read your name and age and write a program to display the year in which you will
y2 = float(input("Enter y-coordinate of the second point: "))
be 100 year old in python
Ans:
print("The distance between the two points is:", distance(x1, y1, x2, y2))
name =input("ENTER YOUR NAME :-")
age=int(input("ENTER YOUR AGE :-"))
H=2025+(100-age)
print("Hi" ,name,"! you will be 100 years old in the year =", H)

Q3. Read width and length of a cone and write a program to find the area of a
rectangle cone in phython.
Ans
import math
pi = [Link]

# Function to calculate Volume of Cone volume = 1/3(pi * r * r * h)


def volume(r, h):
return (1 / 3) * pi * r * r * h

# Function To Calculate Surface Area of Cone area = pi * r * s + pi * r^2

def surfacearea(r, s):


return pi * r * s + pi * r * r

radius = float(input("enter radius :- "))


height = float(input("emter height :- "))
slat_height = float(input("enter slant height :- "))
print("Volume Of Cone : ", volume(radius, height))
print("Surface Area Of Cone : ", surfacearea(radius, slat_height))

You might also like