I wrote these programs.
# Determining the root of a quadratic equation
def discriminant(secterm, priterm, constant):
discrinum = priterm * priterm - 4 * secterm * constant
if discrinum > 0 :
result = "Two different facts"
elif discrinum == 0 :
result = "Medium muscle"
elif discrinum < 0 :
result = "Two different lungs"
print("This equation has %s because the value of the discriminant is [%f]" &(discriminum, result))
There's an error like this. What's the problem?
Traceback (most recent call last):
File "C:/Users/user/OneDrive/Desktop/Hana High School/Curricular/Information/Performance.py", line 38, in <module>
discriminant(secterm, priterm, constant)
File "C:/Users/user/OneDrive/Desktop/Hana High School/Curricular/Information/Performance.py", line 12, in discriminant
print("This equation has %s because the value of the discriminant is [%f]" &(discriminum, result))
TypeError: unsupported operand type(s) for &: 'str' and 'tuple'
&
--> %
print ("This equation has %s because the value of the discriminant is [%f").%(discriminum, result)
© 2024 OneMinuteCode. All rights reserved.