Personal Web Page Generator 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 screens: Enter your name: Describe yourself: Once the user has entered the requested input, the program should create an HTML file, containing the input, for a simple Web page.

Respuesta :

Answer:

// Python code

username=input("Type your name: ")

desc=input("Describe yourself: ")

f=open('profile.html','w')

html="<html>\n"+\

     "<head>\n"+\

     "</head>\n"+\

     "<body>\n"+\

     "<center>\n"+\

     "<h1>"+username+"</h1>\n"+\

     "</center>\n"+\

     "<hr/>\n"+\

     desc+"\n"\

     "<hr/>\n"+\

     "</body>\n"+\

     "</html>\n"

f.write(html)

f.close()

Code for profile.html file

<html>

<head>

</head>

<body>

<center>

<h1>Jon Doe</h1>

</center>

<hr/>

A software engineer working at a startup.

<hr/>

</body>

</html>

Explanation:

  • Get the name and description of user  as an input.
  • Write HTML content by opening the file.
  • Create and develop the essential HTML syntax.
  • Write the information into the HTML file and finally close the file.
  • Write the HTML code in the profile.html file.
ACCESS MORE