Newbie, homework help, please.

someone wesbroom at gmail.com
Sat Apr 21 16:14:03 EDT 2012


On Saturday, April 21, 2012 12:28:33 PM UTC-5, someone wrote:
> Ok, this is my dillema, not only am I new to this programming buisness, before the last few days, I did not even know what python was, and besides opening up the internet or word documents, that is most of what I know. Yet, I have a professor who should be on Psych medication for giving us 3 projects, 2 of which I have not listed here to do. I was able to do research over the last 3 days, and I have spent 3 days on this project, by borrowing others ideas on this project. Below, you will find my professors assignment (oh, and due in one week right before finals, so I am stressing out so much, cause I don't know why he is crazy enough to assign crap like this a week before finals when I have Calculus final,chem final, etc. I have figured out most of the assignment, and below, it will be posted after the teacher's post of the assignment. What I need help with, and I have tried relentlessly to find, is how to put freaking stars(asterisks) as border around a list without installing any other program to a portable python, of course, this is where my problem lies. Below, you will see what I have done, please, help!!!
> You are required to complete and submit the following programming projects in Python by the indicated deadline:
> 
> Standard Header Information project (5 pts):
> Write a program that will:
> 1) Ask the user for the following information:
> 	- name of file to be created for storing SHI
> 	- user’s name (as part of SHI)
> 	- user’s course and section (as part of SHI)
> 	- user’s semester and year (as part of SHI)
> 	- user’s assignment title (as part of SHI)
> 2) Write the above SHI data to a text (.txt) file with the name chosen by the user (above)
> 3) Close the file that the SHI data was written to
> 4) Open the file with the SHI data (again)
> 5) Read the data into different (from part 1) variable names
> 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      *
> 	*                     *
> 	***********************
> 
> 
> textfile=input('Hello, we are about to create a text file. An example would be: (sample.txt) without the parenthesis. What ever you do name it, it needs to end in (.txt). What would you like to name your textfile?')
> userinput=[input('What is your name?'),input('What is your Course Section and Course number?'),input('What is the Semester and year?'),input('What is the title of this class assignment?')]
> for item in userinput:
>     openfile=open(textfile,'w');openfile.writelines("%s\n" % item for item in userinput);openfile.close()
> x=textfile;indat=open(x,'r');SHI=indat.read()
> def border(Sullivan):
>     string=SHI
>     stringlength=len(string)
>     stringlength=stringlength("%s\n" % item for item in stringlength) + 2 * (3 + 3)
>     hBorder=stringlength//2*"* "+"*"[:stringlength%2]
>     spacer="*"+" "*(stringlength - 2)+"*"
>     fancyText="*  "+string+"  *"
>     return(hBorder,spacer,fancyText,hBorder)
> 
> textTuple = border(SHI)
> for lines in textTuple:
>     print (lines)

Thanks for your reply Mr. Roy Smith. Also, thanks for the tip. Maybe I did not make myself as clear or maybe you did not understand my post. It states homework help, and I am doing this post to get help before I pay somebody to show me how to do it, because, obviously our professor is not kind enough to show us how to do this less than two weeks before the due date with 3 projects (and now I have basically less than a week before it is due- and I am not waiting till the last minute), and this just so happens to be the easier one. I understand the concept of him trying to give us deadlines and making us learn, but I don't appreciate paying for a class where I am not taught anything or told the right direction due to his belief that he is helping me to get a stronger work ethic, I have 5 classes this semester, and stupid me, I had to take the hardest ones I could not realizing the depth of the struggles I would face. Again, thanks for the tip, but I never asked you to do my homework, it clearly states that I did research over the last few days, over the internet, because our brilliant professor is giving us just the slim end of what he believes is enough to get us through. I took posted script and made it work by figuring it out to fit the assignment. At least, I am trying, want to guess at how many people have buddies in this class and they will copy this off of them before due date? Please, don't judge people because you think you are doing me a favor by saying you will not do my homework for me, I never asked, I said help.



More information about the Python-list mailing list