Python Forum
TypeError: can't multiply sequence by non-int of type 'str'
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TypeError: can't multiply sequence by non-int of type 'str'
#4
I have not really analysed your code, but clearly there is a mismatch with types when multiplying "cost[0] * cost[1]", such as multiplying a numeric variable with a string. If you are unsure what happens on that line, you can print cost[0] and cost[1] before the multiplication/error.
Reply


Messages In This Thread
RE: TypeError: can't multiply sequence by non-int of type 'str' - by j.crater - Oct-09-2017, 06:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TypeError: unsupported operand type(s) for /: 'str' and 'int' enderfran2006 1 2,741 Oct-01-2020, 09:41 AM
Last Post: buran
  TypeError: can't multiply sequence by non-int of type 'complex' FeverDream 2 12,883 Jul-12-2018, 11:08 PM
Last Post: DeaD_EyE
  TypeError: can't multiply sequence by non-int of type 'str' rmpadilla73 4 30,564 May-28-2018, 12:21 AM
Last Post: py_learner
  python!TypeError: can't multiply sequence by non-int of type 'float' shaywune 2 9,609 Sep-24-2016, 04:33 PM
Last Post: shaywune

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020