Round Numbers in Python

I´m new to Python and can´t figure out how to round the a, b and c output down to 1.1%. Can someone help me on this please?

Hi Clemens
Try this
a = “{:.1f}%”.format(x)

1 Like

Thank you so much!

Hi Naruto, coud you help me with another question? I want to make a traffic light scheme. Therefore I have a number let´s say a (between 0 and 1). If a is under 0.25, I want to make a component (e.g. the color gradient component - or maybe you know a better one?) to green. If a is between 0.25 and 0.75 to orange and above 0.75 to red.

Do you have an idea of how I could do this?

Thanks anyway!
Clemens

Is this what you want?Color.gh (12.5 KB)

1 Like

Yes but do you know a component that shows displays /visualizes color already in the GH environment?

Thanks, Clemens

“Legend” component?

1 Like

Awesome!