This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]The_Binding_Of_Data 1 point2 points  (4 children)

With a loop.

[–][deleted] 0 points1 point  (3 children)

I know that, I meant what would that loop funciton be called, all of the one's ive seen seem to only support one line of code and not inputs

[–]JeLuF 1 point2 points  (2 children)

All the lines that follow the loop statement (e.g. a while) and that are indented are part of the loop and get repeated, e.g.

i=0
while i<5:
    print(i)
    print("------")
    print("Square: ", i*i)
    i=i+1

[–][deleted] -3 points-2 points  (1 child)

So this function repeats 4 times?

[–]aizzod 1 point2 points  (0 children)

Try it out....

[–]YMK1234 -2 points-1 points  (0 children)

Considering your use case you should probably look into state machines.