TypeError: can't multiply sequence by non-int of type 'str'

Hello, guys. I have been working on an app about the SIR model of epidemiology and I got this Error.

TypeError: can't multiply sequence by non-int of type 'str'

It was on the 31st line:

B_one=icontact*infection_rate   # 30th line
RNaught_one=B_one*duration  #31st line

Where icontact was the int input value from the user (I inputted 4), infection _rate also an int value 1 and duration also the value 14. So the “non-int” statement just does not make an sense. So, can anyone please tell me what it actually means an how to fix it…Thank You

I think you are trying to multiply two numbers icontact and infection_rate, but they are strings.

You can do B_one=float(icontact)*float(infection_rate).

Or you can set type property of the InputBox to number.

5 Likes

Okay. Let me try it out

Thank you soo much. It works now…