Hi I need help with this python 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" The code is below.   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()

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter8: Advanced Method Concepts
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question
100%

Hi I need help with this python 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"

The code is below.

 

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()

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr