Hello everyone,
Juste started learning python few days ago, I can’t understand my mistake here:
Can someone help me on that ?
Hello everyone,
Juste started learning python few days ago, I can’t understand my mistake here:
Can someone help me on that ?
It is complaining that total
is an int
, i
is a str
and it doesn’t know how to add them.
You could do total += int(i)
. The int(i)
would turn the str
i
into an int
, if it can be turned into one.
Is that
[‘7.1’, ‘7.22’, … ]
the ratings? If so, them maybe you don’t want int
, but float
. In that case, maybe do
total += float(i)