Find the Volume of Sphere in Python
r=float(input("Enter Radius :"))
pie=3.14
volume=(4.0/3.0)*pie*(r*r*r)
print("Volume of Sphere is : ",volume)Output :
Enter Radius : 10
Volume of Sphere is : 4186.666666666667Find the Volume of Sphere in Python
r=float(input("Enter Radius :"))
pie=3.14
volume=(4.0/3.0)*pie*(r*r*r)
print("Volume of Sphere is : ",volume)Output :
Enter Radius : 10
Volume of Sphere is : 4186.666666666667h=float(input("Enter Height :"))
r=float(input("Enter Radius :"))
pie=3.14
volume=pie*(r*r)*h/3
print("Volume of Cone is ", volume)
Output :
Enter Height :10 Enter Radius :5 Volume of Cone is 261.6666666666667
Display ant Table Input by the User in Python
n=int(input("Enter any Number "))
for i in range(1,11):
print('{0} * {1} = {2}'.format(n,i,i*n))
Output :
Enter any Number : 4 4 * 1 = 4 4 * 2 = 8 4 * 3 = 12 4 * 4 = 16 4 * 5 = 20 4 * 6 = 24 4 * 7 = 28 4 * 8 = 32 4 * 9 = 36 4 * 10 = 40
Program to find the triangle are Equilateral , Isosceles and Scalene in python
x=int(input("x :"))
y=int(input("y :"))
z=int(input("z :"))
if x == y == z:
print("Equilateral Triangle ")
elif x==y or y==z or z==x:
print("Isosceles Triangle")
else:
print("scalene Triangle")
Output :
x :10 y :45 z :10 Isosceles Triangle
base1=float(input("Enter Base1 of a Trapezoid :"))
base2=float(input("Enter Base2 of a Trapezoid :"))
height=float(input("Enter Height of a Trapezoid :"))
area=0.5*(base1+base2)*height
print("Area of Trapezoid : ", area)
Output :
Enter Base1 of a Trapezoid :4 Enter Base2 of a Trapezoid :5 Enter Height of a Trapezoid :10 Area of Trapezoid : 45.0
x=int(input("x :"))
y=int(input("y :"))
z=int(input("z :"))
if x==y or y==z or z==x:
print("Isosceles Triangle")
else:
print("Not Isosceles Triangle")
Output :
x : 12 y :41 z :12 Isosceles Triangle
#Area of Square with math.pow in python
import math
side=float(input("Enter side of square :"))
area=math.pow(side,3)
print("area of square : ", area)
Output :
Enter side of square :10
area of square : 1000.0
#Area of Square in Python
side=float(input("Enter side of square :"))
area=side*side
print("area of square : ", area)
Output :
Enter side of square :45 area of square : 2025.0
rafe=str(input("What are you making : "))
name=str(input("Name : "))
age=str(input("Age : "))
da=str(input("Date Of Birth : "))
print("PERSONAL INFORMATION")
fa=str(input("Father Name : "))
ma=str(input("Mother Name : "))
va=str(input("Village : "))
print("QUALIFICATION ")
pera=str(input("Enter Percentage in 10th class : "))
per=str(input("Enter Percentage in 12th class : "))
ho=str(input("Hobby : "))
aim=str(input("Aim of life : "))
print("\n")
print("***********************************")
print("* \t", rafe ,"\t *")
print("* \t", name ,"\t *")
print("* \t", age ,"\t *")
print("* \t", da ,"\t *")
print("* \t", "PERSONAL INFORMATION" ,"\t *")
print("* \t", fa ,"\t *")
print("* \t", ma ,"\t *")
print("* \t", va ,"\t *")
print("* \t", "QUALIFICATION" ,"\t *")
print("* \t", pera ,"\t *")
print("* \t", per ,"\t *")
print("* \t", ho ,"\t *")
print("* \t", aim ,"\t *")
print("***********************************")
# Area of Parallelogram
base=float(input("Enter Base of Parallelogram : "))
height=float(input("Enter Height of Parallelogram :"))
area=base*height
print("Area of Parallelogram : ",area)
Output :
Enter Base of Parallelogram : 5 Enter Height of Parallelogram :12 Area of Parallelogram : 60.0
n=int(input("Enter Value of n :"))
a=0
b=1
c=a+b
print(a)
print(b)
while c<=n:
print(c)
a=b
b=c
c=a+b
Output :
Enter Value of n :4 0 1 1 2 3
n=int(input(" Enter any Number :"))
def fib(n):
a=0
b=1
if n==1:
print(a)
else:
print(a)
print(b)
for i in range(2,n):
c=a+b
a=b
b=c
print(c)
fib(n)
Output :
Enter any Number :4
0
1
1
2
n=float(input("Enter a Number :"))
fact =1
while(n>=1):
fact=fact*n
n-=1
print("Factorial :",fact)
Output :
Enter a Number :5
Factorial : 120.0
pi=22/7
height=float(input("Height of Cylinder :"))
radius=float(input("Radius of Cylinder : "))
volume=pi*radius*radius*height
print("Volume is : ",volume)
Output :
Height of Cylinder :15
Radius of Cylinder : 5
Volume is : 1178.5714285714284
import math
a=float(input("Enter The Value of a :"))
volume=math.pow(a,3)
print("volume :",volume)
Output :
Enter The Value Of a :4
volume : 64.0
nm=(input(" Name :"))
print(nm)
Output :
Name :Harmanpreet Singh
Harmanpreet Singh
import math
radius=float(input("Enter radius of the circle : "))
area=math.pi*radius*radius
print("area of circle",area)
Output :
Enter radius of the circle : 4
area of circle 50.26548245743669
radius=float(input("Enter radius of the circle : "))
area=3.14*radius*radius
print("area of circle",area)
Output :
Enter radius of the circle : 5
area of circle 78.5
#Area of Rectangle
width=float(input("Enter the width of the Rectangle :"))
height=float(input("Enter the height of the Rectangle :"))
area=width*height
print("area of the rectangle",area)
print("\n")
Output :
Enter the width of the Rectangle :41
Enter the height of the Rectangle :5
area of the rectangle 205.0
a= int(input("Enter First Number : "))
b= int(input("Enter Second Number : "))
a=3
b=5
sum=a+b
print("sum of two numbers")
print(a,"+", b, "=",sum)
Output :
nm=str(input("Enter Name : "))
print(nm)
Output :
Enter Name : Gurnoor
Gurnoor
Count Upper Case and Lower Case Word in a string (Python) def string_test(s): d={"UPPER_CASE":0, "LOWER_CASE":...