[Tutor] For Loops and nested loops
Steve Willoughby
steve at alchemy.com
Sat Aug 16 19:35:31 CEST 2008
On Sat, Aug 16, 2008 at 06:33:42AM +0100, Umesh Singhal wrote:
> Hi im still relatively new to python and i am designing a multiplication table that enables a user to input the size of the times table unfortunately ive stumbled on the nested loops this is what i have right now:
Is this a homework assignment? Forgive me if it's not, but somehow
it feels like the sort of thing a teacher would assign. At least,
I've been known to give my programming students things like it
before when they were just starting out.
> a=raw_input('please enter a number')
> b=int(a)
> n=b+1
> for row in range(1, n):
remember what <n> means in range(1, <n>). You may have a fencepost
error (off-by-one), depending on what you intended to happen here.
--
Steve Willoughby | Using billion-dollar satellites
steve at alchemy.com | to hunt for Tupperware.
More information about the Tutor
mailing list