You are on page 1of 1

# take input from user

l=int(input('Enter the length of the Beam in meters:' ))


e=int(input('Enter the modulus of Elasticity in Newton per meter square:'))

#ask choice from users for beam

print('Enter The choice for cross section')


m=int(input('Enter 1 for Rectangular Cross section and 2 for circular cross
section:'))

#running if else function for the chosen beam and calculating i

if m==1:
b=int(input("Enter the width in mm:"))
de=int(input("Enter the depth in mm:"))
i= (b*de*de*de)/12
elif m==2:
d=int(input("Enter the diameter in mm:"))
i=(3.14*d*d*d*d)/64

#asking user for the type of beam

print("Enter 1 for cantilever beam carrying point load at its end")


print("Enter 2 for cantilever beam carrying uniformly distributed length over its
entire length")
print("Enter 3 for simpy supported beam carrying point load at the middle")
print("Enter 4 for simply supported beam carrying uniformly distributed load over
its entire length")
a=int(input("Enter the choice for type of beam:"))

#asking for value of y and calculating y for the selected beams.

if a==1:
w=int(input("Enter load in Newton:"))
y=(w*l*l*l)/(3*e*i*pow(10,-12))
elif a==2:
w=int(input("Enter the load in Newton per meter:"))
y=-(w*l*l*l*l)/(8*e*i*pow(10,-12))
elif a==3:
w=int(input("Enter the load in Newton:"))
y=-(w*l*l*l)/(48*e*i*pow(10,-12))
elif a==4:
w=int(input("Enter the load in Newton per meter:"))
y=-(5*w*l*l*l*l)/(382*e*i*pow(10,-12))
#finally calculating the deflection using the value of y of the chosen beam

print("The deflection in the beam is :",round(y,3)*pow(10,3),"in mm")

You might also like