Unsupported operation type(s) for &: 'str' and 'tuple' are not allowed

Asked 2 years ago, Updated 2 years ago, 100 views

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'

python def

2022-09-22 17:56

1 Answers

& --> %

print ("This equation has %s because the value of the discriminant is [%f").%(discriminum, result)


2022-09-22 17:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.