Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have to submit the python file and a flowchart. Problem Statement: Write a pro

ID: 3720522 • Letter: I

Question

I have to submit the python file and a flowchart.

Problem Statement:

Write a program that asks the user for his or her name, then asks the user to enter a sentence that describes himself or herself. Here is an example of the program’s screen:

Enter your name: Julie Taylor (Press Enter to continue)

Describe yourself: I am a computer system technology student, a member of the Jazz club, and I hope to work as a mobile app developer after I graduate. (Press Enter to continue)

Once the user has entered the requested input, the program should create an HTML file, containing the input, for a simple Web page. Here is an example of the HTML content, using the sample input previously shown:

<html>

<head>

<title>My Personal Web Page</title>

</head>

<body>

                  <center>

                           <h1>Julie Taylor</h1>

                  </center>

                  <hr />

I am a computer system technology student, a member of the Jazz club, and I hope to work as a mobile app developer after I graduate.

                  <hr />

         </body>

</html>

Prompt the user the user to enter the name and description and store it in name and description variables. Open a file in write mode and use html_file as a file object. Define a function named write_html and pass html_file, name, and description as an argument to the write_html function. From the write_html function call write_head function and pass html_file as an argument. In write_head function you should write the following lines to your file:

<html>

<head>

<title>My Personal Web Page</title>

</head>

Then, again from the write_html function call write_body function and pass html_file, name, and description as arguments. In write_body function you should write the following lines to your file:

                          

                           <body>

                                             <center>

                                                      <h1>use parameter that describes name of a person</h1>

                                             </center>

                                             <hr />

use parameter that describes description of a person

                                             <hr />

                                    </body>

</html>

Finally, close the file.

Explanation / Answer

Python 2:

def write_html(html_file, name, description):
   write_head(html_file)
   write_body(html_file, name, description)

def write_head(html_file):
   html_file.write("<html> <head> <title>My Personal Web Page</title> </head> ")

def write_body(html_file, name, description):
   html_file.write("<body> <center> "+
       "<h1>"+name+"</h1> </center> <hr /> "+
       description+" <hr /> </body> </html>")

if __name__=="__main__":
   name=raw_input('Enter your name:')
   description=raw_input('Describe yourself:')
   html_file=open('output.html','w')
   write_html(html_file,name,description)
   html_file.close()

Python 3:

def write_html(html_file, name, description):
   write_head(html_file)
   write_body(html_file, name, description)

def write_head(html_file):
   html_file.write("<html> <head> <title>My Personal Web Page</title> </head> ")

def write_body(html_file, name, description):
   html_file.write("<body> <center> "+
       "<h1>"+name+"</h1> </center> <hr /> "+
       description+" <hr /> </body> </html>")

if __name__=="__main__":
   name=input('Enter your name:')
   description=input('Describe yourself:')
   html_file=open('output.html','w')
   write_html(html_file,name,description)
   html_file.close()