On 02/07/13 06:41, Jack Little wrote:
In my concept, when the player buys a boost, their karma (a global) is
multiplied by 25% when added to. How would I do this?
karma = karma * 0.25
which can be written as:
karma *= 0.25
If this is inside a function (as it should be!) you will need to indent the
line, and include a declaration at the top of the function:
global karma
karma *= 0.25
However, are you sure you want to multiply their karma by 25%? That makes it
smaller. Perhaps you want to INCREASE it by 25%, which would be calculated like
this:
global karma
karma *= 1.25
or perhaps:
karma = karma + 0.25*karma
--
Steven
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor