How to prompt a user & input answer into a variable?

Asked by tjonnyc

I would like to prompt the user for a number, then use that number to run a particular loop a specific number of times.

1.) Pop up a question: "How many times to run?"
2.) Read input - integer from 1 to 99999.
3.) Use the input as a variable to control loop iterations ( "for a in range(TimesToRun): {some code})

Could someone provide a basic example of this?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

number = input("Give me a number")

for n in range(int(number)):
...

no validation of course ;-)
will crash if given number is invalid

Can you help with this problem?

Provide an answer of your own, or ask tjonnyc for more information if necessary.

To post a message you must log in.