What is the simplest method to get a vector result?

Ian Kelly ian.g.kelly at gmail.com
Fri Jul 25 03:50:34 CEST 2014


On Thu, Jul 24, 2014 at 7:29 PM, fl <rxjwg98 at gmail.com> wrote:
> On Thursday, July 24, 2014 10:25:52 AM UTC-4, Marko Rauhamaa wrote:
>> #!/usr/bin/env python3
>>
>> import math
>>
>> for x in range(0, 361, 15):
>>
>>     print(int((math.sin(x / 180 * math.pi) + 1) * 30 + 0.5) * " " + "*")
>>
>> ========================================================================
>>
>>
>> Marko
>
> I like your method, but I get a column of '*'. Maybe you have other intentions
> of your code. I am puzzled about the last part of your code and want to learn
> from it ("   * " " + "*"   ").

You probably ran it with Python 2. That code was written for Python 3
and assumes that division of two ints will return a float.  You can
also fix it by adding the line "from __future__ import division" at
the top of the file.



More information about the Python-list mailing list