-4

I want to repeat an action for n times. I've tried "if" but it does not work.

If actiontimes == n:
    Print text*n

Thanks for any advice

Ahhaha
  • 11
  • 1
  • 2
  • 1
    For one thing, that's not Python; case matters. – jonrsharpe Sep 17 '16 at 09:14
  • Your code is invalid Python, but you can create a function and count how many times you run the function. – grooveplex Sep 17 '16 at 09:15
  • [**The `range()` Function**](https://docs.python.org/3.5/tutorial/controlflow.html#the-range-function) and [**`for` Statements**](https://docs.python.org/3.5/tutorial/controlflow.html#for-statements) are shown in the first chapters of the tutorial. How could you miss that? – Matthias Sep 17 '16 at 09:26

1 Answers1

6

You have to write:

for x in range(times):
    #action to repeat
dreamwhite
  • 116
  • 8
  • @Ahhaha please don't comment 'thanks'. Instead, accept the answer by clicking the check mark next to if it solved your problem. – grooveplex Sep 17 '16 at 09:18