Help with HP Prime Python Documentation
|
10-04-2021, 12:08 PM
Post: #1
|
|||
|
|||
Help with HP Prime Python Documentation
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 |
|||
10-04-2021, 03:46 PM
Post: #2
|
|||
|
|||
RE: Help with HP Prime Python Documentation
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. |
|||
10-04-2021, 06:57 PM
Post: #3
|
|||
|
|||
RE: Help with HP Prime Python Documentation
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 |
|||
10-04-2021, 08:32 PM
Post: #4
|
|||
|
|||
RE: Help with HP Prime Python Documentation
(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 |
|||
10-05-2021, 05:59 AM
Post: #5
|
|||
|
|||
RE: Help with HP Prime Python Documentation
Impressive Python code! I really like the second code example!
Namir |
|||
10-05-2021, 06:49 AM
Post: #6
|
|||
|
|||
RE: Help with HP Prime Python Documentation
(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. Tom L Cui bono? |
|||
10-05-2021, 06:27 PM
Post: #7
|
|||
|
|||
RE: Help with HP Prime Python Documentation
(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 |
|||
10-05-2021, 09:13 PM
Post: #8
|
|||
|
|||
RE: Help with HP Prime Python Documentation
Not to disapoint Gunter, here is his code, edited:
Code: from math import * Namir |
|||
10-05-2021, 10:10 PM
Post: #9
|
|||
|
|||
RE: Help with HP Prime Python Documentation
(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 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)