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

Which one of the following substances produces ammonia gas when heated with ammonium chloride solution? a. Sodium oxide b. Sulphur dioxide c. Hydrochloric acid
happy life is the main motto of life explain​
What climate does Europe NOT have?
How is the word unyielding related to the word resolute? It is a synonym. It is an antonym. It is a cognate. It is an analogy.
During Medieval Times, catapults, battering rams, and scaling ladders were used in what type of warfare? A. Calvary warfare B. Siege warfare C. Naval warfare D.
NEED ASAP WILL GIVE BRAINLIEST IF RIGHT Read the following claim. Tiera Fletcher's parents supported their daughter in her endeavors. How would Tiera Fletcher M
-5/6 x (-3/10) what is the answer?
17+18 (eaaazz points my man)
HELP AS SOON AS POSIBLE
Give 3 examples of how we use fungi in the production of food