hey guys, little help with this project. The language required is Python 3. Than
ID: 3576061 • Letter: H
Question
hey guys, little help with this project. The language required is Python 3. Thank you
1. Write a program that reads file “input.txt”, and writes each line in “output.txt”, preceded by line numbers. Put your code in a main() function and call main() at the end of the program. If the input file is: Mary had a little lamb Whose fleece was white as snow. And everywhere that Mary went, The lamb was sure to go! then the program produces the output file output.txt 1: Mary had a little lamb 2: Whose fleece was white as snow. 3: And everywhere that Mary went, 4 : The lamb was sure to go! 2. Write a program that prints the number of characters and lines in file “input.txt”. 3. Write any turtle graphics that you want. Your program should contain at least two turtles.
Explanation / Answer
def main():
f1 = open("input.txt","r")
f2 = open("output.txt","w")
count = 1
for line in f1.readlines():
s = str(count)+": "+line
f2.write(s)
count+=1
main()
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.