-3

I am writing out a code that is about the user entering information about the dimensions of a room. The code contains this subprogram:

def area(input_number1, input_number2):
    variable = input_number1 * input_number2
    return variable

This subprogram's function is to generate the area of a wall by the user entering the length and width and it returns the area to the user. For some reason, it isn't working?

It returns this error message:

TypeError: can't multiply sequence by non-int of type 'str'
vaultah
  • 44,105
  • 12
  • 114
  • 143
User0123456789
  • 760
  • 2
  • 10
  • 25
  • 4
    "the user entering information ". You probably didn't convert the entered input from a `str` to an `int` or `float`. –  Apr 08 '16 at 17:04
  • 1
    Try `print(repr(input_number1), repr(input_number2))`. They are strings, not ints. – tdelaney Apr 08 '16 at 17:12

1 Answers1

1

you need to convert the input (string) to int so that you can do calculations

  input_number1 = int(input_number1)
ryanmoir
  • 229
  • 3
  • 11