Post Reply 
HP prime Python code Python app
06-16-2021, 06:07 PM
Post: #1
HP prime Python code Python app
Hello everyone,

I am new to the forum and to the HP Prime, so I am sorry for my lack of knowledge on both of them. Now, I bought my HP prime few months ago, and I saw it had a Python support, so I tried to run a Python code I wrote on my computer and after some time of making the code more simple etc. I managed to make it work on my HP prime. I would enter the CAS mode and call my program with a () on the end and it showed me all the dialogue windows I wanted and calculated everything I wanted. However, yesterday I updated it and on the connectivity kit it now shows that it is Beta version and the calculator now has new app, Python, and my program would no longer work in the CAS mode, it would just reboot the calculator when i tried to run it, like before. Now I saw few posts on how to run a python code, but with me being new to calculator, I didn't find them helpfull.
I was wondering if someone, who doesn't mind explaining this to me, a newbie, could tell me how to run a Python code, previously wrote on my pc in the python app. I understood there were numeric view, which is a shell, and a symbolic view, in which I can write the program on a calculator itself, but I don't see any save options, and I don't know how to run the program wrote in Symb in a Num view. An actual example would probably be the best.
Once again, please remeber I am new to HP graphic calculator,

Best regards
Find all posts by this user
Quote this message in a reply
06-16-2021, 09:15 PM (This post was last modified: 06-16-2021 10:23 PM by Gene.)
Post: #2
RE: HP prime Python code Python app
This reminds me of a problem that I have with the latest update too, although I must say am having trouble understanding all of the above. I would also be vastly appreciative if someone could give an in-depth explanation regarding the newest HP software improvement.
Thanks in advance!
Find all posts by this user
Quote this message in a reply
06-16-2021, 11:31 PM
Post: #3
RE: HP prime Python code Python app
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.
Find all posts by this user
Quote this message in a reply
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 




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