[Tutor] How do you save work in progress in Pyscripter ?
Thomas Mujica
tmujica at verizon.net
Fri Apr 6 21:11:11 CEST 2012
Please help a newbie
Was able to write and successfully run this but I can't seem to be able to
"save" it
Luckily I had saved it to Word and then I was able to copy and paste it back
into PyScripter.
I'm using
Python Scripter Version 2.5.3.0 x86
*** Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit
(Intel)] on win32. ***
*** Remote Python engine is active ***
>>>
>>> from decimal import *
>>> getcontext()
Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999999, Emax=999999999,
capitals=1, flags=[], traps=[DivisionByZero, InvalidOperation, Overflow])
>>> getcontext().prec=3 #change decimal precision to 3
decimal places
>>> for a in xrange(1,30): #NESTED note no matter what the variables are
the syntax is always xrange
... 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 raised to exponent 2
... h=pow(c,.5) #pow is .5 so h is the
square root of c ...h is the hypotenuse
... d=round(h,2)
... if a==1 and b==1: #will allow titles to be
printed at beginning of print out
... print "Side a","Side b","Hypotenuse"
... if h==d and d==h: #will eliminate all values of h
that are not integers from printout
... print" ",a,"\t",b,"\t\t",h #for alignment purpose "3
spaces " before a then tab b, and 2tabs ...
# before h
Side a Side b Hypotenuse
3 4 5.0
4 3 5.0
5 12 13.0
6 8 10.0
7 24 25.0
8 6 10.0
8 15 17.0
9 12 15.0
10 24 26.0
12 5 13.0
12 9 15.0
12 16 20.0
15 8 17.0
15 20 25.0
16 12 20.0
18 24 30.0
20 15 25.0
20 21 29.0
21 20 29.0
21 28 35.0
24 7 25.0
24 10 26.0
24 18 30.0
28 21 35.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120406/7f1f2849/attachment-0001.html>
More information about the Tutor
mailing list