#!/usr/bin/python
Import time
Import Script1
Import Script2
Import Script3
Options = {'Script1.py', 'Script2.py', 'Script3.py'}
no_of_options = 3
choice = int( time.time() ) %no_of_options
if choice == 0:
python (Script1.py)
if choice ==1:
python (Script2.py)
if choice == 2:
python (Script3.py)
I want to randomize the script chosen. But I've noticed that the first script is always executed no matter what. Also, if I write 'import Script2.py' first, then Script2 gets executed first no matter what. Please help me fix this.
Please offer some help. I have written three modules as separate .py files and a different one needs to be executed randomly. Tell me how to execute a different module each time depending on the value of choice.
Edit : Here is what I want to do. There are three different patterns available. I have written a separate Python program to print each of these patterns. One of these three patterns must randomly be executed. What I have tried to do is get a random number and then accordingly execute one of these three scripts to display the corresponding pattern.
Please correct the syntax or suggest a better way to do this.