example python ppl with subroutines hp prime - 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: example python ppl with subroutines hp prime (/thread-17076.html) |
example python ppl with subroutines hp prime - Liamtoh Resu - 06-08-2021 01:53 AM The following demonstrate the useage of subroutines in python and ppl. A simple pi approximation was used. edit: fixed ppl code, was missing predeclaration for cls(). python: Code:
ppl Code:
This is for those who are looking for a starting point. Thanks/ RE: example python ppl with subroutines hp prime - toml_12953 - 06-08-2021 05:28 AM (06-08-2021 01:53 AM)Liamtoh Resu Wrote: edit: fixed ppl code, was missing predeclaration for cls(). You don't need to pre-declare functions anymore. The below still works. Code: // aprxpi01 RE: example python ppl with subroutines hp prime - Liamtoh Resu - 06-08-2021 05:58 AM Ok Tom, Thanks for the quick late night response about the pre-declaration entries. The omission of the predeclarations did not seem to work on the emulator --will check it out on the real hp prime. RE: example python ppl with subroutines hp prime - toml_12953 - 06-08-2021 12:34 PM (06-08-2021 05:58 AM)Liamtoh Resu Wrote: Ok Tom, Are you sure you have the latest beta emulator? It works on mine without the pre-declarations. RE: example python ppl with subroutines hp prime - Liamtoh Resu - 06-08-2021 03:45 PM I had problems trying to get the 20210428 emulator to run so I reverted back to the 2020 emulator. The 20210428 CK is running fine. I have the 20210505 firmware on the real hp prime. I have not sent the updated version to the prime yet. PPL and python are relatively new to me -- I am thinking about backward compatibility. Thanks. edit: The program without the pre-declarations worked ok on the real hp prime. |