"someone" <wesbr...@gmail.com> wrote in message news:32945367.2045.1335029313436.JavaMail.geo-discussion-forums@ynjn4...

6) Display the SHI data read from the file in the interpreter with a border around the SHI data (include a buffer of 1 line/space between the border and SHI data). An example might look like:

***********************
*                     *
* First Name and Last *
* ENGR 109-X          *
* Fall 2999           *
* Format Example      *
*                     *
***********************

I'm not a Python programmer, but I'll have a go at the text formatting bit:

text=["First Name and Last","ENGR 109-X","Fall 2999","Format Example"]

maxwidth=0
for s in text:
if len(s)>maxwidth: maxwidth=len(s)

vertinchlines=6    # assume 6 lines/inch
hozinchchars=10    # assume 10 chars/inch

hozmargin=" "*hozinchchars

newtext=[]
for i in range(vertinchlines):
newtext.append("")

newtext.append(hozmargin+"*"*(maxwidth+4)+hozmargin)
newtext.append(hozmargin+"* "+" "*maxwidth+" *"+hozmargin)

for s in text:
newtext.append(hozmargin+"* "+s+" "*(maxwidth-len(s))+" *"+hozmargin)

newtext.append(hozmargin+"* "+" "*maxwidth+" *"+hozmargin)
newtext.append(hozmargin+"*"*(maxwidth+4)+hozmargin)

for i in range(vertinchlines):
newtext.append("")

for s in newtext:
print (s)

--
Bartc --
http://mail.python.org/mailman/listinfo/python-list

Reply via email to