Write code that does the following opens the numberlisttxt


1. Write code that does the following: opens an output file with the filename number_list.txt, uses a loop to write the numbers 1 through 100 to the file, and then closes it.

Here is my answer to the 1st question
file = open('filename number_list.txt', 'w')
for i in range(1,100):
file.write('{}n'.format(i))
file.close()

2. Write code that does the following: opens the number_list.txt file that was created by the code you wrote in question 3, reads all of the numbers from the file and displays them, and then closes the file.

Solution Preview :

Prepared by a verified Expert
Business Management: Write code that does the following opens the numberlisttxt
Reference No:- TGS02283874

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)