pricanoanda pricanoanda
  • 26-03-2017
  • Computers and Technology
contestada

Write a short program that uses a for loop to write the numbers 1 through 10 to a file

Respuesta :

Аноним Аноним
  • 26-03-2017
An example would be as follows:

outfile = open('filename.txt', 'w')
for num in range (1, 11):
outfile.write(str(num) + '\n')
outfile.close()

And a second example:

dataFile = open("filename", "w")
for line in range(11):
    dataFile.write("%s\n" % line)
dataFile.close()


Hope this helps.
Answer Link

Otras preguntas

if a= -2 and b = 4 3a^2- 5b =6ab^2=
what type of figurative language is being used in this sentence ''silence is a blank space that begs to be filled''
sediment that settles on the bottom of the sea may form layers of rock which description tells how this sediment is deposited. A.)randomely B.)vertically c.)dia
What are unlike denimonators
Which of the following trigonometric ratios has a value that is undefined?
Are the triangles similar? If so what is the similarity statement?
A company sells boxes of duck calls (d) for $35 and boxes of turkey calls (t) for $45. they make batches of duck calls that fill 6 boxes and batches of turkey c
Can a organ be part of two organ systems HELP
Congress has established to local courts for the District of Columbia— a court of appeals and a___. A) tax court B) superior court C) civil tribunal D) clai
Simone purchased a tree seedling that was 6.23 cm tall. The seeding is now 4 times its original height. What is the seedling's height?