Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #65707

Re: Python 2.7.6 help with modules

Subject Re: Python 2.7.6 help with modules
From Scott W Dunning <swdunning@cox.net>
Date 2014-02-08 17:28 -0700
References <032F2E23-6983-4710-B087-C1771B66C3EF@cox.net> <635C857D-1F7A-4F95-B3A7-F1A3C69BF137@cox.net> <PiY11n00m3bjUJS01iY3b8>
Newsgroups comp.lang.python
Message-ID <mailman.6558.1391910757.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Feb 7, 2014, at 11:29 PM, Chris Angelico <rosuav@gmail.com> wrote
> Close! But if you print out foo and bar, you'll see that you're naming
> them backwards in the second one. The last digit is the remainder
> (modulo), the rest is the quotient.

So, this is more like what you’re talking about?

>>> first = number / 10
>>> second = number % 10
>>> last = first %10
>>> rest = second / 10

I feel stupid saying this and it’s probably because of the variables I’m using but I’m not sure what the above is doing.  For some reason it’s confusing me.  I used the number 55664, so the variable (first) is saying take 55664 and / it by 10, then (second) is saying take the original number divide it by 10 and spit out the remainder?  Then from there (last) is saying take the original number / it by 10 then take that number and divide it by 10 again and give me the remainder?  Then finally (rest) is saying take the remainder of the original number after dividing by ten and divide that number by 10? I guess I’m confused on the result I’m looking for.

I know I’m asking very elementary questions so I really do appreciate not only all of your help but, your patients too!!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python 2.7.6 help with modules Scott W Dunning <swdunning@cox.net> - 2014-02-08 17:28 -0700

csiph-web