Below is the program for the above information.
Python
def main():
# Get the information from the user
name = input("Enter your name: ")
degree_major = input("Enter your degree major: ")
future_career = input("Enter your future career: ")
career_description = input("Enter a brief description of your future career: ")
# Create the HTML file for writing
with open('user_information.html', 'w') as html_file:
# Write the HTML content
write_html(html_file, name, degree_major, future_career, career_description)
def write_html(html_file, name, degree_major, future_career, career_description):
# Write the HTML tag
html_file.write("<!DOCTYPE html>")
# Write the head element
write_head(html_file, "User Information")
# Write the body
write_body(html_file, name, degree_major, future_career, career_description)
# Write the closing HTML tag
html_file.write("</html>")
def write_head(html_file, title):
# Write the opening head tag
html_file.write("<head>")
# Write the opening title tag
html_file.write("<title>" + title + "</title>")
# Write the closing head tag
html_file.write("</head>")
def write_body(html_file, name, degree_major, future_career, career_description):
# Write the body tags
html_file.write("<body>")
html_file.write("<h1>User Information</h1>")
html_file.write("<p>Name: " + name + "</p>")
html_file.write("<p>Degree Major: " + degree_major + "</p>")
html_file.write("<p>Future Career: " + future_career + "</p>")
html_file.write("<p>Career Description: " + career_description + "</p>")
html_file.write("</body>")
if __name__ == "__main__":
main()
So, the above program is one that defines three functions (write_html, write_head, and write_body) to handle writing different parts of the HTML document.
Hence, The main function takes user input and creates an HTML file by calling these functions. The resulting HTML file (user_page.html) will contain the information entered by the user.