If-elif condition - Syntax Error

Hi

I am trying to do my first script using if-elif condition.
My goal is to have as the output a list of points for the coordination system selected based on the x value.
As inputs, I have the x value (slider) and 3 lists with points of the cs.
I structured the script in the following way:

import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *



desk_numbers = IN[0]
cs1 = IN[1]
cs2 = IN[2]
cs3 = IN[3]

if desk_numbers == 1
    result = cs1
elif desk_numbers == 2
    result = cs2
elif desk_numbers == 4
    result =  cs3
else:
    OUT = "No desks"
OUT = result;

I get the syntax error for lines 14 and 21.
Could you please help me identify what’s wrong with my script?

Many thanks!

Best regards,

Julia

Hello,
here are 2 tracks but not in python (I need to progress on this aspect)

(You are angry with the 3 :grinning: :wink:)

Cordially
christian.stan

2 Likes

Looks like you need a : at the end of line 14, 16 and 18. It’s already placed correctly on line 20 though.

Also, no need for the ; at the end of line 22.

2 Likes

Thank you very much!! It works:)

BR,

Julia

1 Like

Hi Christina,

thank you for this solution.
It can work for me as well!

Best regards,

Julia

1 Like