[Tutor] User input question

Kyle Babich kb@mm.st
Thu, 8 Aug 2002 14:02:23 UT


I'm still a newbie to python so I am taking my best guess in saying to
un-indent the print that is causing the error.

On Thu, 8 Aug 2002 14:15:32 +0100, "shey crompton" <shey@argonaut.com>
said:
> I have been trying to modify a script that prints out the times tables
> to
> one that asks the user to input which times table they would like
> printed
> out (between 1 and 13).
> I have tried so many different ways of doing this without any success.
> I am
> sure it's a simple answer, but I am starting to get frustrated.
> The script below is my latest attempt, and the error message I get is
> below
> it.=20
> Hints, and tips greatly appreciated.
>=20
> Shey
>=20
>=20
> def timestab(n):
>     if i < 13:
>         print "%d x %d =3D %d" % (i,n,i*n)
>     else:
>         print "Only positive numbers between 1 and 12 please!"
>=20
> i =3D input('Try a number ')
>     print timestab(i)
>=20
>=20
> The error message is:
>=20
> File "C:\Documents and Settings\shey\Desktop\timesTab_8.py", line 15
>     print timestab(i)
>     ^
> SyntaxError: invalid syntax
>=20
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>=20

--
Kyle