EvilZone
Programming and Scripting => Scripting Languages => : sarat1998 February 08, 2013, 06:53:05 PM
-
I was wondering if there is any code to generate a dynamic number of loops (where the number is specified by the user) in python. Any help would be deeply appreciated.
-
Sure, just do a loop, like "for (i=0; i=random(from,to); i++):"
The random in that place should find the last execution of the loop, and then execute the loop that quantity of times.
I don't know the actual implementation because I have not learned Python yet, but that's the basic structure of what you want to do... I guess...
Off-topic: Sorry for the bad english, still not fully awaken.
-
thanks for the reply man!
-
I am guessing you are new to programming then? This is something very easy to accomplish. Do something similar to this.
x = int(input("Enter number: "))
for i in range(x):
#do something here.
At least that is the general idea. Hope it helps.
-
thanks for the reply but I found the solution. We have to use product in itertools to do this.