简体   繁体   中英

How to repeat an action in Python

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

You have to write:

for x in range(times):
    #action to repeat

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM