I need help with this code. It keeps giving me the error "Traceback (most recent call last): File "main.py", line 29, in plus() File "main.py", line 6, in plus num1 = float(input("Input the first number you'd like to add:")) TypeError: 'str' object is not callable" It would be great if you could help me. import math input = input("Enter either Plus, Minus, Multiply, or Divide exactly like listed") def plus(): num1 = float(input("Input the first number you'd like to add:")) num2 = float(input("Input the second number that you would like to add:")) num3 = float(input("Input the third number that you would like to add:")) num4 = float(input("Input the forth number that you would like to add:")) num5 = float(input("Input the fith number that you would like to add:")) print(num1 + num2 + num3 + num4 + num5) def minus(): x = float(input("Input the first number you'd like to subtract:")) y = float(input("Input the second number that you would like to subtract:")) print(x - y) def divide(): d1 = float(input("Input the first number you'd like to divide:")) d2 = float(input("Input the second number that you would like to divide:")) print(x / y) def multiply(): m1 = float(input("Input the first number you'd like to multiply:")) m2 = float(input("Input the second number that you would like to multiply:")) print(m1 * m2) if input == "Plus": plus() if input == "Minus": minus()
I need help with this code. It keeps giving me the error "Traceback (most recent call last):
File "main.py", line 29, in <module>
plus()
File "main.py", line 6, in plus
num1 = float(input("Input the first number you'd like to add:"))
TypeError: 'str' object is not callable"
It would be great if you could help me.
import math
input = input("Enter either Plus, Minus, Multiply, or Divide exactly like listed")
def plus():
num1 = float(input("Input the first number you'd like to add:"))
num2 = float(input("Input the second number that you would like to add:"))
num3 = float(input("Input the third number that you would like to add:"))
num4 = float(input("Input the forth number that you would like to add:"))
num5 = float(input("Input the fith number that you would like to add:"))
print(num1 + num2 + num3 + num4 + num5)
def minus():
x = float(input("Input the first number you'd like to subtract:"))
y = float(input("Input the second number that you would like to subtract:"))
print(x - y)
def divide():
d1 = float(input("Input the first number you'd like to divide:"))
d2 = float(input("Input the second number that you would like to divide:"))
print(x / y)
def multiply():
m1 = float(input("Input the first number you'd like to multiply:"))
m2 = float(input("Input the second number that you would like to multiply:"))
print(m1 * m2)
if input == "Plus":
plus()
if input == "Minus":
minus()
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images