# Asking python coding

**URL:** <https://discourse.mcneel.com/t/asking-python-coding/132003>\
**Category:** Grasshopper\
**Tags:** windows, python\
**Created:** [October 21, 2021, 6:08am UTC](https://discourse.mcneel.com/t/asking-python-coding/132003 "2021-10-21T06:08:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![puree.srisuk64](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/puree.srisuk64/32/472905_2.png) [@puree.srisuk64](https://discourse.mcneel.com/u/puree.srisuk64)\
**Post date:** [October 21, 2021, 6:08am UTC](https://discourse.mcneel.com/t/asking-python-coding/132003/1 "2021-10-21T06:08:44Z")

</div>

Hello, I student of computational design so I still practicing Python in rhino so I have some questions about coding.

 ![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/3/9/5/3955f2320e0408c0d6db9f9d88f9dcda4efdd6bc.png)  
from picture If x == 10 I wanna to print sin interpcurve else not 10 print sin points. How to code this condition? thank you

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [October 21, 2021, 7:16am UTC](https://discourse.mcneel.com/t/asking-python-coding/132003/2 "2021-10-21T07:16:52Z")

</div>

Hi,

I’m not exactly sure what it is that you want to do, but the code on lines 16 to 20 - currently commented out - should do the trick. On line 18, get rid of the space between `print` and `(new_curve)`. `print` in Python 3 is a function, thus the parentheses.

You can’t compute and thus print the sine of an interpolated curve or list or points. `math.sin()` excepts a floating point or integer number, representing an angle in radians.

What exactly is x? Where does it come into play? Is it a number, a list of something?

---

<div class="post-metadata">

**Author:** ![puree.srisuk64](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/puree.srisuk64/32/472905_2.png) [@puree.srisuk64](https://discourse.mcneel.com/u/puree.srisuk64)\
**Post date:** [October 21, 2021, 7:58am UTC](https://discourse.mcneel.com/t/asking-python-coding/132003/3 "2021-10-21T07:58:30Z")

</div>

![image](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/4/8/a/48a7e01354b660c70340b73c9fd9c7f551a3a03b.jpeg)  
something like this simple

---

<div class="post-metadata">

**Author:** ![diff-arch](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/diff-arch/32/528268_2.png) [@diff-arch](https://discourse.mcneel.com/u/diff-arch)\
**Post date:** [October 21, 2021, 8:56am UTC](https://discourse.mcneel.com/t/asking-python-coding/132003/4 "2021-10-21T08:56:57Z")

</div>

Something like this?

```python
import rhinoscriptsyntax as rs 
import math

points = []
scale = 1.5

for i in range(100):
    pt = ([scale * math.sin(i), i, 0])
    points.append(pt)

x = 10
if x == 10:
    [rs.AddPoint(pt) for pt in points]
else:
    rs.AddInterpCurve(points)

```

It would probably be a good idea to make `x` a boolean (True/False), instead of 10, since you only seem to want to switch between two cases.

**Example:**

```python
import rhinoscriptsyntax as rs 
import math

points = []
scale = 1.5

for i in range(100):
    pt = ([scale * math.sin(i), i, 0])
    points.append(pt)

bake_curve = False
if not bake_curve:
    [rs.AddPoint(pt) for pt in points]
else:
    rs.AddInterpCurve(points)

```
