Help with HP Prime Python Documentation - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: HP Prime (/forum-5.html) +--- Thread: Help with HP Prime Python Documentation (/thread-17543.html) |
Help with HP Prime Python Documentation - Namir - 10-04-2021 12:08 PM Hi All, I have been playing with microPython of the TI NSpire CAS emulator. When I downloaded the latest HP Prime emulator yesterday I saw the Python App. I was able to easiliy do simple calculations. I am interested in writing Python programs for the HP Prime. In either case, where can I find the best (and most comprehensive) documentation for the Python on the HP Prime? Namir RE: Help with HP Prime Python Documentation - Guenter Schink - 10-04-2021 03:46 PM Namir, there isn't much documentation for Python in Prime. When the Prime was updated (as Beta) Tim released some notes, not really excessive I did some practice with my Mandelbrot Explorer and scratched a little bit on the surface of Python Olivier de Smet published a HP41CX Emulator a real marvel I think These two examples create a new APPS. But a Python program also can be embedded in PPL program as I did here. Perhaps these examples give you some hints what can be made. Some documentation is available in the Prime itself.
But a lot of fun - definitively. RE: Help with HP Prime Python Documentation - Namir - 10-04-2021 06:57 PM Thank you Gunter. I have been using Python on the TI NSpire CAS emulator and it works well. I write numerical analysis code and copy-and-run various sorting algorithms from the internet. I appreciate sample code that shows me how to include Python source code and then launch it! Namir RE: Help with HP Prime Python Documentation - Guenter Schink - 10-04-2021 08:32 PM (10-04-2021 06:57 PM)Namir Wrote: Thank you Gunter. I have been using Python on the TI NSpire CAS emulator and it works well. I write numerical analysis code and copy-and-run various sorting algorithms from the internet. I appreciate sample code that shows me how to include Python source code and then launch it! Preface: don't rely on what I say, I'm an amateur. But let's give it a try. I've changed my benchmark code a little to avoid the hassle with sys.argv Code: #PYTHON name with [Shift][1][New] create a new program e.g. sums, delete the template that is in it, copy and paste the code above. Now from the program catalog run this program. Disregard the input field and touch OK. Now it asks for an exponent, enter e.g. 5 and your done. Alternatively, create a new APP. Save the Python App under a new name e.G. "Sums" Open its ("Sums") source code editor by touching [Symb]. Copy the following part of the code Code:
Günter RE: Help with HP Prime Python Documentation - Namir - 10-05-2021 05:59 AM Impressive Python code! I really like the second code example! Namir RE: Help with HP Prime Python Documentation - toml_12953 - 10-05-2021 06:49 AM (10-04-2021 08:32 PM)Guenter Schink Wrote:(10-04-2021 06:57 PM)Namir Wrote: Thank you Gunter. I have been using Python on the TI NSpire CAS emulator and it works well. I write numerical analysis code and copy-and-run various sorting algorithms from the internet. I appreciate sample code that shows me how to include Python source code and then launch it! Do you really want to set the starting time before the input statement? That won't just time the machine, it'll include the time it takes for you to answer the question as well. RE: Help with HP Prime Python Documentation - Guenter Schink - 10-05-2021 06:27 PM (10-05-2021 06:49 AM)toml_12953 Wrote: Do you really want to set the starting time before the input statement? That won't just time the machine, it'll include the time it takes for you to answer the question as well. No, that glitch happened when I changed this little code snipped in a rush to get rid of the sys.argv command. But as it wasn't meant to provide an impressive piece of code, rather than an example how to get the basics for creating a basic Python App it should suffice. Let's leave it to Namir to correct that nonsense Günter RE: Help with HP Prime Python Documentation - Namir - 10-05-2021 09:13 PM Not to disapoint Gunter, here is his code, edited: Code: from math import * Namir RE: Help with HP Prime Python Documentation - Guenter Schink - 10-05-2021 10:10 PM (10-05-2021 09:13 PM)Namir Wrote: Not to disapoint Gunter, here is his code, edited: Thanks for correcting that glitch. I'd strongly recommend to have a closer look to my Mandelbrot Explorer mentioned in an earlier post. Not so because it's impressive but because it's my Python learning bench. And I've tried to include some Python specifics, just because they are there. And once again have a look at the HP41cx emulator of Oulan, that really gives you something to chew on and explore. Let's talk about that in detail during the HHC 2022 Günter |