[Tutor] Raw input query (?)

Alan Gauld alan.gauld at btinternet.com
Thu Aug 25 16:17:04 CEST 2011


On 25/08/11 10:46, Lisi wrote:
> I copied and ran the following script:
>
> multiplier = 12
>
> for j in range(1,13):
>      print "%d x %d = %d" %(j, multiplier, j*multiplier)
>
> That ran perfectly and gave me the 12 times table.
>
> I then decided that it would be fun to branch out and make teh
> script "universal", so I wrote and ran:
>
> print "Which times table do you want?"
>
> multiplier = raw_input ()

I seem to recognise that code :-)

You will find if you fast-forward to the "talking to the user" topic 
that we revisit the multiplication table doing exactly this. You will 
find out what is missing there. :-)

HTH,

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list