Post Reply 
HP Prime Python runs consecutive programs
09-29-2023, 08:36 PM (This post was last modified: 09-29-2023 08:38 PM by toml_12953.)
Post: #10
RE: HP Prime Python runs consecutive programs
(09-29-2023 05:47 PM)Pellidon Wrote:  Thanks, that worked.

When I pasted the code in, my indents were deleted.

(09-28-2023 09:31 PM)Guenter Schink Wrote:  One solution is: <SHIFT> <PLOT> that gives you access to the Python setup. There untick "Files will auto load when changed". Now you can run your programs simply by typing
"import cone" or "import red" or whatever names your modules have.
without quoting of course

Günter

PS: your code is garbled. Better use "insert formatted code"
Something like this?

Code:
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.
Code:
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

Tom L
Cui bono?
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 - toml_12953 - 09-29-2023 08:36 PM



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