[Tutor] re division problem
prasad rao
prasadaraon50 at gmail.com
Tue Feb 3 14:24:16 CET 2009
> 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?
There are 100 characters in the string(string.printable)
I deleted '\n\t'. So 98/say 4==24.5 So if there is a fraction
I have to round it off to 1. So 24.5 should be rounded off
to 25..But is there a better way to print it in given number
of 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?
No. How can I ensure that every value is an integer but without missing
in retrieving an element in the string.
Prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090203/4dda1818/attachment.htm>
More information about the Tutor
mailing list