Re: [Tutor] How do you save work in progress in Pyscripter ?
On 06/04/12 20:11, Thomas Mujica wrote:
> *Was able to write and successfully run this but I can’t seem to be able
> to “save” it*
You have written the code at the interactive prompt which is really
intended for experimenting.
To save the code as a python script you need to create a plain text
file and save it with a .py extension (assuming you are on Windows).
You could use something as basic as Notepad to create it but most IDEs
or specialist programming editors will be more useful. I don;t know
pyscripter but usually you can use the File->New menu to create a new
blank editor window where you can type the code. You then save it with
File->Save/SaveAs as usual. How you run it varies by IDE...
Note you don't type the >>> and other stuff that the interpreter puts
out, so your code would look like:
from decimal import *
getcontext().prec=3 #change decimal precision to 3 decimal places*
for a in xrange(1,30): #NESTED note no matter what the variables
for b in xrange(1,30): #LOOPS DO 29 ITERATIONS*
c=pow(a,2)+pow(b,2) # this is really c squared because a and b are
h=pow(c,.5) #pow is .5 so h is the square root of c …..h is the
if a==1 and b==1: #will allow titles to be printed at beginning of
print "Side a","Side b","Hypotenuse"
if h==d and d==h: #will eliminate all values of h that are not
print" ",a,"\t",b,"\t\t",h #for alignment purpose “3 spaces “
There are some odd things in that code that I could comment on, but for
now I'll ignore them and see if you can get the script running first.