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

What's hellinistic culture??
Alice's grandmothers age is a composite number between 70 and 80 and has a factor of 11 what is it
whats the ratio of 0.6 to 12 to the lowest term
Which function represents the number of seconds , s in d days ( hint the number seconds in a day us 24x60x60=86,400 the function that represents the number of s
)The figure below shows parallel lines cut by a transversal: A pair of parallel lines is shown, cut by a transversal. Angle 1 is located in the upper right e
whats the ratio of 0.6 to 12 to the lowest term
what is the purpose of analyzing a play
in one eighth of an hour ,ms.wolf can grade one third of a stack of papers how many hours will it take her to grade 2 stacks
80 questions how many can I get wrong to get 75%
Before 1880, most of the immigrants were from western Europe. After 1880, 70% of the immigrants were from A. Asia. B. Ireland. C. northern Russia and east