On Feb 7, 2014, at 10:10 PM, Chris Angelico <ros...@gmail.com> wrote:
> It might be easiest to think in terms of a single "divide into > quotient and remainder" operation. Let's leave aside > weeks/days/hours/minutes/seconds and split a number up into its > digits. (This is actually not as useless as you might think; in low > level programming, this is how to display a number on the screen, for > instance.) > > number = int(raw_input("Enter a five-digit number: ")) > > Now we begin to split it up: > > foo = number % 10 > bar = number / 10 > > Do you know, without running the code, what 'foo' and 'bar' will be? > Give those two variables better names (hint: one of them would be > appropriately named "last_digit"), and then work on some more pieces > of the puzzle. So, if I use the five digit # 50000, bar = 5000, and foo = 0 because there is no remainder after dividing by 10? Does it make a difference weather foo or bar are written first? Thanks for the help Chris! > https://mail.python.org/mailman/listinfo/python-list
-- https://mail.python.org/mailman/listinfo/python-list