Sine wave?
Bengt Richter
bokr at oz.net
Sun Dec 22 18:26:17 EST 2002
On 22 Dec 2002 22:32:25 GMT, bokr at oz.net (Bengt Richter) wrote:
[... some modified code...]
> # print first 34 samples as selfscaling ascii plot
> grid = list(' |%19s|%19s|' %('',''))
grid = ' |%19s|%19s|' %('','')
[...]
> print ''.join(grid[:x]+['*']+grid[x+1:])
print grid[:x]+'*'+grid[x+1:]
>
Kind of silly to use a list, the way I wound up doing it ;-)
You could also eliminate the grid and change the print to
print ''.join([' |*'[i==x and 2 or i in (1,21,41)] for i in range(42)])
Regards,
Bengt Richter
More information about the Python-list
mailing list