dumb newbie questions

Jonathan Gardner jgardn at alumni.washington.edu
Thu Jan 17 16:35:03 EST 2002


On Friday 18 January 2002 04:28 am, Andrew Koenig wrote:
 
>
> The readline function returns the entire input line as a string,
> including the newline at the end.  That's not what you want -- you
> want to convert the line to an integer.  To do so, write
>
>         row=int(sys.stdin.readline())
>
> and similarly for col.

And once you get it turned into an int, you should be able to do:

for i in range(row):

and similarly for col and j.

Don't forget to check what they typed in for col and row!

if not row or not col:
	raise Exception, "Invalid inputs!"

Jonathan




More information about the Python-list mailing list