When running my program and giving a user input, it only does the last function in the code. I know what is wrong with the code, I am redefining the same function with different arguments. However, I do not know how to change this so that the code will run the function that matches the user input. Here is the code I wrote for the program.
import math
from math import pi
def equation(Lift):
d = float(input("Input d value: "))
v = float(input("Input v value: "))
A = float(input("Input A value: "))
CL = float(input("Input CL value: "))
Lift = .5 * d * (v ** 2) * A * CL
a = ["Lift = ", Lift, "Newtons"]
for i in range (3):
print(a[i], end =" ")
def equation(VCylinder):
r = float(input("Input r value: "))
h = float(input("Input h value: "))
VCylinder = pi * (r ** 2) * h
a = ["Volume of Cylinder =", VCylinder, "m³ (meters³)"]
for i in range(3):
print(a[i], end =" ")
def equation(Exponentdx):
n = int(input("Input n value: "))
u = n
v = n - 1
a = ["dx =", u,"x","**", v, " "]
for i in range(5):
print(a[i], end =" ")
def Main():
print("Currently only compatible with base metric units (meters,
kilograms, etc.)")
Equation = input("Enter desired equation: ")
equation(Equation)
Main()