[Tutor] Division problems

Kent Johnson kent37 at tds.net
Tue Feb 3 12:56:06 CET 2009


On Tue, Feb 3, 2009 at 3:42 AM, prasad rao <prasadaraon50 at gmail.com> wrote:
> Hello
> I wrote a function named vertical to print string .printable characters and
> ASCII values in a table.
> 1)It is swallowing some characters.
> 2)It output some characters  2 or 3 times.
> 3)It prints one column more than what I asked for.

> def vertical(columns):
>         import string
>         v=string.printable
>         v=v.replace('\n','')
> v=v.replace('\t','')

What is len(v) here? What is len(v)/columns?

>         for x in range((len(v))/columns):
>                 for y in range(x,len(v),x+((len(v))/columns)):

The third argument to range() is the step size. Do you want to use a
different step size for each row?

Kent


More information about the Tutor mailing list