What's new

Help Python

Phc-TheCoffeeToy

Eternal Poster
Established
Joined
Apr 7, 2016
Posts
877
Reaction
347
Points
338
This is the problem sir but ayaw mag run ng na compile ko. Patulong naman sa marurunong need ko talaga

The program will ask for a parabolas vertex and focus point. it then returns the diretrix, the length and endpoints of the latus rectum, axis of symmetry, and if it opens upward or downward.

ito yung code ko

a=float(input("Enter distance from center to vertex"))
b=float(input("Enter distance from center to co-vertex"))
c=float(input("Enter distance from center to focus"))

def parabola('a', 'b', 'c'):
print ("Vertex: (" , (-b / (2 * a)) , ", "
,(((4 * a * c) - (b * b)) / (4 * a)) , ")" )

print ("Directrix: y="
, (int)(c - ((b * b) + 1) * 4 * a ))

parabola(a, b, c)

elif parabola in ['x=2, 'y=4']:
print ("Axis of Symmetry")
elif parabola in ['upward', 'downward']:
print ("Opening")
print ("END PROGRAM")
 
Python:
def parabola(a, b, c):
    print("Vertex: (" , (-b / (2 * a)) , ", ",(((4 * a * c) - (b * b)) / (4 * a)) , ")")
    print("Directrix: y=", (int)(c - ((b * b) + 1) * 4 * a ))

a=float(input("Enter distance from center to vertex "))
b=float(input("Enter distance from center to co-vertex "))
c=float(input("Enter distance from center to focus "))

parabola(a, b, c)
 

Similar threads

Back
Top