1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nekit [7.7K]
4 years ago
8

Write code that does the following: opens an output file with the filename number_list.txt, uses a loop to write the numbers 1 t

hrough 100 to the file, then closes the file.
Computers and Technology
1 answer:
Lady_Fox [76]4 years ago
8 0

Answer:

# create the file

filename = "Testfile.txt"

# for writing, we create the output file:

outPutfile = open(filename, "w")

# Writing numbers from 1-100

for item in range(1,101):

 outPutfile.write((str)(item))

outPutfile.close()

# printing the contents to verify it worked correctly

infile = open(filename, "r") #note the "r" indicates the mode

fileContents = infile.read()

infile.close()

print(fileContents)

Explanation:

  • Define the working file fileName = TestFile
  • Create the output file for writting outPutfile = open(filename, "w")
  • Use a for loop to write numbers from 1-100 to the file outPutfile.write((str)(item))
  • Close the file outPutfile.close()
  • You may open the file read its content and print the contents to verify it worked correctly
You might be interested in
I have tried installing "windows media player" on my computer but at a point, something disrupts its instalment or I am asked to
Minchanka [31]
Windows media player should come pre-installed on your system and does not cost anything. You likely have malware on your system. I would download Malwarebytes antimalware from here

https://www.malwarebytes.org/mwb-download/thankyou/

There is a premium version but just do the free one. Install and run. Let it get rid of the bad stuff it finds. I would also make sure you have an up to date Antivirus software and run a scan. There are plenty of good free ones if you don't have one installed already.
6 0
3 years ago
Which type of drawer has three dispensing modes: single-dose, multi-dose, and matrix?
ad-work [718]

Answer:

CUBIE MiniDrawer Bin

Explanation:

MiniDrawers comes in two configurations, and each fitting comes in one drawerslot. The MiniDrawer (1-6) comes with the most primary pocket dimensions. And we have the 18-tray MiniDrawer (1-8) comes with another dimensions in its basic form. You will in fact find various pocket dimensions like 1,2,3,4,6,12, and these comes within the 18-tray and 6-tray MiniDrawers. And they come in all the dispensing modes mentioned in the question. Hence, the above answer. The answer is clear from the options as well, and since it has the matrix mode as well apart from single dose mode and multi dose mode.

6 0
3 years ago
What is the relationship between agile teams and project requirements
spin [16.1K]

Answer:

Agile follows a non-linear process, unlike conventional project management, which focuses more on teamwork, cooperation, and versatility, as opposed to a strict sequence of activities.Agile project management takes an iterative approach to project management, which time-boxes tasks into fast sprints.

Explanation:

4 0
3 years ago
A computer processes data only using 1s and 0s
ArbitrLikvidat [17]
Yes it only processes data using 1s and 0s
8 0
3 years ago
Read 2 more answers
Query " frosty the snowman
julsineya [31]
I don't think that is a query...
5 0
3 years ago
Other questions:
  • HELP ME RIGHT NOW !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    8·1 answer
  • What is a function library?
    11·1 answer
  • Write a complete Java method that returns an integer. The method declares a Scanner object, then prompts the user for a series o
    12·1 answer
  • Gabe Kelp is a fourteen-year-old goalie for the Soaring Eagles soccer team. He and his teammates are each creating a screen name
    11·1 answer
  • Consider the following threats to Web security, and describe how each is countered by a particular feature of SSL.
    15·1 answer
  • Suppose you own a travel agency in a large city. You have many corporate clients, but growth has slowed somewhat Some long-term
    15·1 answer
  • Design a flowchart for an algorithm which adds prim numbers starting from 1 up to 50. Change
    9·1 answer
  • Choose the correct term to complete the sentence.
    12·1 answer
  • D State Six Impact of ICT the society​
    7·1 answer
  • Yaaaaaa.........
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!