Post Reply 
HP Prime Python runs consecutive programs
09-25-2023, 03:00 PM
Post: #6
RE: HP Prime Python runs consecutive programs
These are the two scripts. Only difference between these and the Casio are the random imports.

Cone program. Calculates the sheet metal size for a rolled cone.
from math import *
import math

major = input("major dia=")
major = float(major)
#print(major)
minor = input("minor dia=")
minor = float(minor)
#print(minor)
height = input("height=")
height = float(height)
#print(height)
o = math.sqrt((height*major/(major-minor))**2+(major/2)**2)
i = math.sqrt((height*minor/(major-minor))**2+(minor/2)**2)
angle = 360*major/(2*o)
r_angle = angle*(pi/180)
if angle >180:
x = o+o*sin(((angle-180)*(pi/180))/2)
y = 2*o
else:
x = o-i*cos((angle/2*(pi/180)))
y = 2*o*sin((angle/2*(pi/180)))
print("radius 1 = {0:6.3f}".format(o))
print("radius 2 = {0:6.3f}".format(i))
print("angle = {0:6.2f}".format(angle))
print("b height = {0:6.3f}".format(x))
print("b width = {0:6.3f}".format(y))
if y>144:
print("blank oversized")

red.py is a list of the magic eight ball responses that comes up randomly when pressing enter.
from micropython import *
from urandom import *
from urandom import random
import random

eightlist = ["It is certain ",
"Reply hazy, try again",
"Don’t count on it",
"It is decidedly so",
"Ask again later",
"My reply is no",
"Without a doubt",
"Better not tell you now",
"My sources say no",
"Yes definitely",
"Cannot predict now",
"Outlook not so good",
"You may rely on it",
"Concentrate and ask again",
"Very doubtful",
"As I see it, yes",
"Most likely",
"Outlook good",
"Yes",
"Signs point to yes" ]

shake = ""

while True:
shake = input("Shake for answer ")
if shake == "":
print (random.choice(eightlist)
)
#print (eightlist[eightball])
else:
print ("Thanks for playing")
break

Cone runs then at the end, it displays <import> red.py and runs that program.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP Prime Python runs consecutive programs - Pellidon - 09-25-2023 03:00 PM



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