Python Forum
Function Execution Times - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Function Execution Times (/thread-16807.html)



Function Execution Times - sunnyarora - Mar-15-2019

Hi,
If we want that any Python Function should work only once or twice then how can be done the same?
Thanks


RE: Function Execution Times - Larz60+ - Mar-15-2019

run once or twice.
Please explain a bit better and receive a better answer.


RE: Function Execution Times - Yoriz - Mar-15-2019

import random

def any_python_function(something):
    print(something)


once_or_twice = random.choice((1,2))

for times in range(once_or_twice):
    any_python_function(once_or_twice)



RE: Function Execution Times - sunnyarora - Mar-15-2019

I want to execute the program in in two parts

first;
We input the password from user and store aside.

second ;
We again input password to give them access if first input password matches with second.

Thanks