Post Reply 
new user python on hp prime g2, casio cg50
05-24-2021, 05:11 PM (This post was last modified: 05-24-2021 05:14 PM by toml_12953.)
Post: #3
RE: new user python on hp prime g2, casio cg50
(05-24-2021 03:52 PM)Liamtoh Resu Wrote:  I put the following on the cg50 which i can run on the casio
and from a windows cmd line shell via "python test0004.py".

# 20190704 casio cg50
# micro python
# print string array
# test0004.py
import math
j=3
a=['moe','larry','curly']
print (j)
print (a)
for j in range(3):
x=a[j]
print (x)

===

This blog post does not present the indentation of the python source code
of the last two lines, x=a[j], print(x).

===

Is there a way to put this program into the prime via the
prime hp connectivity kit and then run it from the prime?

Thanks.

Yes, you can write the program like this:

Code:
#PYTHON(name)
# 20190704 HP Prime
# micro python
# print string array 
# test0004.py
import math
j=3
a=['moe','larry','curly']
print (j)
print (a)
for j in range(3):
  x=a[j]
  print (x)
#end
EXPORT test0004(name)
BEGIN
  PYTHON(name);
END;

Then copy it to the programs folder in the CK. You can run it like an HPPL program from the menu.

You can put your code between code tags (# in the list) to preserve the indentation.

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


Messages In This Thread
RE: new user python on hp prime g2, casio cg50 - toml_12953 - 05-24-2021 05:11 PM



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