Post Reply 
Python comes to the Casio fx-CG 50
10-24-2018, 12:49 PM
Post: #9
RE: Python comes to the Casio fx-CG 50
Feature wise, the HP Prime beats the Casio fx-CG 50. I wish the fx-CG 50 allowed us to choose more than 8 colors like the HP Prime does.

The Casio fx-CG 50 Python module is Micro Python 1.9.4. The set consists of primary basic universal commands (print, while, if, input, float, int, etc.), the math module, and a few commands from the random module. I found that most of the time I would be accessing the commands through the catalog. What is nice is that the catalog in Python mode is tailored to that mode.

Sample Python Code: The Four Means

User enters data. When finished, enter -9999. By the way, to enter negative numbers in Python mode, the minus key [ - ] is used, not the negate key.
Code:

means.py:

import math
print("Enter -9999")
print("to terminate.")
# initialization
x=float(input("Data: "))
n=0
sx=0
ss=0
ps=1
# Enter data
while x!=-9999:
  n=n+1
  sx=sx+x
  ss=ss+x**2
  sr=sr+x**-1
  ps=ps*x
  print(" n = ", str(n))
# calculations
print("Means")
print("Arithmetic ",str(sx/n))
print("Geometric ", str(math.pow(ps,1/n)))
print("Harmonic ", str(n/sr))
print("RMS ", str(math.sqrt(ss/n)))
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Python comes to the Casio fx-CG 50 - Eddie W. Shore - 10-24-2018 12:49 PM



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