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]
3 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]3 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
You have $5 and earn $1.75 for each roll of wrapping paper you sell. Write an equation in two variables that represents the tota
qaws [65]

Answer:

A = 5 + 1.75r

Explanation:

Amount you have = $5

Earning per roll of wrapping paper = $1.75

Let

r = number of rolls of wrapping paper

A = Total amount earned

A = 5 + 1.75r

Equation that represents the total amount A (in dollars) you have after selling r rolls of wrapping paper is

A = 5 + 1.75r

3 0
3 years ago
Types of network model​
dexar [7]

Answer:

OSI Model and TCP/IP Model

Explanation:

4 0
2 years ago
An internal _____ refers to a specific representation of an internal model, using the database constructs supported by the chose
boyakko [2]

Answer:

An internal schema                                                            

Explanation:

  • The internal schema refers to the physical storage structure of database.
  • It refers to the lowest level of abstraction.
  • This is also called physical schema.
  • It contains multiple instances of multiple internal records.
  • It provides information about the representation of the whole database that what data is stored in DB and in what form e.g the data is stored in the records form on the disk.
  • This schema gives detailed description of internal model which involves storage structure of the database, representation and classification of stored data. This format of data is only understandable by the Database management system.
7 0
3 years ago
Compare the time spent on each of the above operations, and describe your observations. If an operation is too fast, you may wan
Artist 52 [7]

Here's the complete question below that clarifies what you need to do

<u>Explanation</u>:

"In this task, we will study the performance of public-key algorithms. Please prepare a file ( message.txt) that contains a 16-byte message. Please also generate an 1024-bit RSA public/private key pair. Then, do the following:

1)Encrypt message.txt using the public key; save the the output in message_enc.txt.

2)Decrypt message_enc.txt using the private key.

3)Encrypt message.txt using a 128-bit AES key.

<em><u>Compare the time spent on each of the above operations, and describe your observations. If an operation is too fast, you may want to repeat it for many times, i.e., 5000 times, and then take an average.</u></em>

<em><u> After you finish the above exercise, you can now use OpenSSL's speed command to do such a benchmarking. Please describe whether your observations are similar to those from the outputs of the speed command?</u></em>

3 0
3 years ago
A network interface port has collision detection and carrier sensing enabled on a shared twisted-pair network. From this stateme
hram777 [196]

Answer:

This is an Ethernet port operating at half duplex.

Explanation:

Modern Ethernet networks built with switches and full-duplex connections no longer utilize CSMA/CD. CSMA/CD is only used in obsolete shared media Ethernet (which uses repeater or hub).

7 0
3 years ago
Read 2 more answers
Other questions:
  • Jeremy Bridges is an executive for Green Web Designs, where his primary role is to ensure the security of business systems and d
    6·1 answer
  • 10.Find the first ICMP Echo Request message that was sent by your computer after you changed the Packet Size in pingplotter to b
    8·1 answer
  • What does it mean to read visual and audio text
    7·1 answer
  • If an author is creating a reference list and wants the second and succeeding lines indented for a reference, they should select
    13·2 answers
  • Creation of ____________will help you to study the behavior of the real system
    11·1 answer
  • Help please im not sure what this means T^T
    12·2 answers
  • Jackie created a poster for a rock band. Which file format will best preserve the graphics? 20PTS​
    14·2 answers
  • Naseer has inserted an image into his document but needs the image to appear on its own line.
    8·1 answer
  • Compare mini and mainframe computer in terms of speed,memory and storage​
    15·1 answer
  • Byte pair encoding is a data encoding technique. The encoding algorithm looks for pairs of characters that appear in the string
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!