Is there a way to subtract 3 from every digit of a number?

Grant Edwards grant.b.edwards at gmail.com
Sat Feb 20 12:31:09 EST 2021


On 2021-02-20, MRAB <python at mrabarnett.plus.com> wrote:

> Have a look at the 'translate' method of the 'str' class.

That's very clever, but being too clever on homework assignemnts
doesn't always get a good grade. If they've just studied iteration,
the modulus operator, and int/str conversions, then I'd avise using
the "dumb" method.

--
Grant





More information about the Python-list mailing list