#solution accepts file input to insert sentence composed of file content into text file on a new line
#solution outputs the text file contents including the new sentence
#accept input identifying filename
print("Enter the name of the input file:")
file_name = input()
#open, read, and write text file (e.g., "WordTextFile.txt") using open(), read(), write()
with open(file_name, 'r') as file:
lines = file.read().splitlines()
#combine the three words into one sentence
sentence = " ".join(lines)
# open and append sentence to file
with open(file_name, 'a') as file:
file.write("\n" + sentence)
# open, read, and output updated file
with open(file_name, 'r') as file:
updated_file = file.read()
print(updated_file)
To embed this project on your website, copy the following code and paste it into your website's HTML: