Python Scripts
-
So I have a website here LKG that I am trying to recreate using wordpress. My current website has about two dozen python scripts most of which take an input supplied by the user and return various outputs. For example, the advantage page is a very small bit of code that rolls X amount of dice and gives you the average result.
advantage code:
def synergy(dice): from random import randint total = 0 count = 0 while count < 50000: lst = [] rolls = 0 while rolls < dice: tmp = randint(1,20) lst.append(tmp) rolls+=1 high = max(lst) total+=high count+=1 avg = total/count return avg
The HTML if that helps anyone is
<p>Used to see the average benefit from abilities like Stealth Synergy, War Sight, or simple Advantage</p> <p>How many dice are you rolling? Default 2:</p> <form class="stop" method="post" action="/advantage"> <p><input class="stop" name="dice"></p> <p><input class="stop" type="submit" value="Run"></p> </form>
I have the page set up so the html fields are there. I.E. how many dice and the run button is present. But I am a bit lost on how to take what someone enters into that field, feed it into the python code, and finally return the results. Any advise on methods, plugins, etc to solve this issue would be greatly appreciated.
- This topic was modified 3 years, 3 months ago by .
- This topic was modified 3 years, 3 months ago by .
The page I need help with: [log in to see the link]
- The topic ‘Python Scripts’ is closed to new replies.