Post Reply 
HP prime Python code Python app
06-17-2021, 04:57 AM
Post: #4
RE: HP prime Python code Python app
(06-16-2021 11:31 PM)Liamtoh Resu Wrote:  I willl try to explain how I put a simply python program onto the prime.

I cannected the prime to the computer and launched the CK (hp prime conectivity
kit). I put the 20210505 firmware onto the prime. (There is an item in one of the
menus to update or upgrade the calculator). I have the 20210428 beta CK installed.

From the CK I created a new program (aprxpi02) on the prime. (The prime rebooted).

I went to the CK and double clicked on the new program (aprxpi02) which was
empty. A text box appeared and i pasted my prime python program into it

I had to click on on the floppy icon(s) to save the program.

I disconnected the prime to run the program on the prime.

I pressed the <shift> <1> to get a listed of my programs on the prime.

I selected the the program and touched the run item on the prime screen.

Python programs on the prime need a ppl wrapper around them.

The code for aprxpi02 follows

Code:

#PYTHON name
# aprxpi02
import math

def pintro():
  print ("aprxpi02 pi approximation")
  return

def api():
  return 355/113

def pout():
  q1 = api()
  print ("pi = ", q1)

pintro()
pout()

#end 
 
EXPORT aprxpi02()
BEGIN
  PRINT;
  PYTHON(name);
END;


Perhaps someone else has clearer or better process.

You can type the program right into the same editor you use with HPPL (from Home screen: Shift-1, New) and save it the same way also.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP prime Python code Python app - toml_12953 - 06-17-2021 04:57 AM



User(s) browsing this thread: 1 Guest(s)