Title: Python Scripts
Last modified: August 15, 2021

---

# Python Scripts

 *  [Ptrst](https://wordpress.org/support/users/leitknightgaming/)
 * (@leitknightgaming)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/python-scripts/)
 * So I have a website here [LKG](https://www.leitknightgaming.com/) 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 4 years, 8 months ago by [Ptrst](https://wordpress.org/support/users/leitknightgaming/).
    -  This topic was modified 4 years, 8 months ago by [Ptrst](https://wordpress.org/support/users/leitknightgaming/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fpython-scripts%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [mrtom414](https://wordpress.org/support/users/mrtom414/)
 * (@mrtom414)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/python-scripts/#post-14772076)
 * WordPress Runs on PHP, not python. I have an intranet site that uses java to 
   send information to a mainframe computer. To get it to work, I created a PHP 
   function that sends commands through a JAR file to the mainframe. The jar file
   takes the returned values and converts them into a JSON string and returns it
   to WordPress. I was also able to find a connector for java to allow for a connection
   with a database table and write content into the table. I used dbdelta to create
   and maintain the table in WordPress and a Custom WordPress loop to display the
   results. I created it almost 10 years ago and it still running and being used.
 *  Thread Starter [Ptrst](https://wordpress.org/support/users/leitknightgaming/)
 * (@leitknightgaming)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/python-scripts/#post-14773929)
 * That sounds rather intricate. Is there a tutorial or some instructional videos
   covering this process? I don’t have a whole lot of experience with PHP.
 *  [mrtom414](https://wordpress.org/support/users/mrtom414/)
 * (@mrtom414)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/python-scripts/#post-14774073)
 * I don’t think there is a tutorial anywhere. You can make external calls to another
   program from PHP. I don’t use Python so I’m not sure what you need to do to return
   the values. I just played with code when I created my program. The Rest API wasn’t
   even being used at the time. You can take a short course in PHP. If you know 
   any c based languages it should be pretty simple. You can create Object-oriented
   code or procedural code. It supports both.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Python Scripts’ is closed to new replies.

## Tags

 * [input](https://wordpress.org/support/topic-tag/input/)
 * [python](https://wordpress.org/support/topic-tag/python/)
 * [script](https://wordpress.org/support/topic-tag/script/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [mrtom414](https://wordpress.org/support/users/mrtom414/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/python-scripts/#post-14774073)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
