Input function question

Hi there,

I’m new to grasshopper so my question might be dumb, but I can´t find a solution.

Im using Python for GH.

The following sentence, that works on any python interpreter, doesn´t work on python for GH:

num = int (input ( "a number: " ) )
if num > 10 :
print ( “good” )
if num < = 10 :
print ( "bad ")

Does anyone knows what am I doing wrong??

Hi @backheuser

GhPython uses the standard Grasshopper input variables names for inputs. Your code actually works, but quite confusingly, the input is requested on the only command line interface that is available in Rhino: the Rhino command line (not in Grasshopper). Have a look there…

The best idea is just to use the provided variables. Please read about them on the Python Guides page, especially the “Python in Grasshopper” part. (2.7 KB)

PS: Two minor requests for future questions: 1. Please ask new questions in new threads - do not revive old threads. Do not worry and be brave: you are fully entitled to start a new topic; 2. If you reference a definition, please always attach it. Be so kind and do not expect willing assistants to re-create it from a picture.

Hi @piac,

thanks for your answer. Indeed, my qustion was pretty dumb. Anyway, I will star new topics and I will attach the files. Sorry about that.

Don’t worry at all, it’s great you asked! :slight_smile: