A question I have...

geremy condra debatem1 at gmail.com
Sun Oct 24 00:29:01 CEST 2010


On Thu, Oct 21, 2010 at 7:25 PM, Joe Shoulak <joepshoulak at yahoo.com> wrote:
> I'm trying to make a sports simulation program and so far everything has
> worked until I try entering:
>
> Score1 = (Team1Off + Team2Def)/2
>
> I get the error:
>
> TypeError: unsupported operand type(s) for /: 'str' and 'int'
>
> Can someone please explain to me what this means, why it doesn't work and
> what I can do to make it work?

It means that your team names are strings and that dividing strings by
a number doesn't make sense.

>>> ('apple' + 'orange')/2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for /: 'str' and 'int'

Geremy Condra



More information about the Python-list mailing list