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
svet-max [94.6K]
3 years ago
10

Write a loop that displays your name 10 times. 2. Write a loop that displays all the odd numbers from 1 through 49. 3. Write a l

oop that displays every fifth number from 0 through 100. 4. Write a code sample that uses a loop to write the numbers from 1 through 10 to a file. 5. Assume that a file named People.txt contains a list of names. Write a code sample that uses a while loop to
Computers and Technology
1 answer:
irakobra [83]3 years ago
3 0

Answer:

The program in Python is as follows:

#1

for i in range(10):

   print("MrRoyal",end=" ")

print()    

#2

for i in range(1,50,2):

   print(i,end=" ")

print()

#3

for i in range(0,101,5):

   print(i,end=" ")

print()

#4

i = 1

while i <=10:

   print(i,end =" ")

   i+=1

#5

myfile = open("People.txt", "r")

eachLine = myfile.readline()

while eachLine:

   print(eachLine)

   eachLine = myfile.readline()

myfile.close()

Explanation:

The program in Python is as follows:

Program #1

This iterates from 1 to 10

for i in range(10):

This prints the name for each iteration [modify to your name]

   print("MrRoyal",end=" ")

This prints a new line

print()    

Program #2

This iterates from 1 to 49 with an increment of 2

for i in range(1,50,2):

This prints the odd numbers in the above range

   print(i,end=" ")

This prints a new line

print()

Program #3

This iterates from 0 to 100 with a step of 5

for i in range(0,101,5):

This prints every 5th number

   print(i,end=" ")

Print a new line

print()

Program #4

This initializes the number to 1

i = 1

This opens the file in an append mode

f = open("myfile.txt", "a")

This loop is repeated from 1 to 10

while i <=10:

This writes each number to the file

   f.write(str(i))

Increment the number by 1

   i+=1

Close the file

f.close()

Program #5

This opens the file in a read mode

myfile = open("People.txt", "r")

This reads each line

eachLine = myfile.readline()

This loop is repeated for every line

while eachLine:

Print the content on the line

   print(eachLine)

Read another line

   eachLine = myfile.readline()

Close the file

myfile.close()

You might be interested in
The ________ is the biggest power consumer on a mobile computing device.
AleksandrR [38]

The part of a computing device that is the biggest power consumer is;

Central Processing Unit

<h3>Central Processing Unit</h3>

The part of a computing device that cosnumes the most power is called the Central Processing Unit (CPU). This is due to the following reasons;

  • The CPU consists of motherboard and battery that draws power from the socket.

  • The Mother board is equipped with logic gates that are used to implement logic in the computer.

  • The Logic gates are voltage signals that signify the binary information that are fed into the system.

Read more about Central Processing Unit (CPU) at; brainly.com/question/4558917

5 0
3 years ago
To use Click and type feature can be used to format and enter text graphic and other items
trasher [3.6K]
No more info??? Because I can’t think of how to answer this
6 0
3 years ago
how can cindy collaborate with mallory in order for cindy to be able to decrypt all subsequent encrypted messages that are sent
Olenka [21]

Cryptography, like digital signatures, is used to accomplish nonrepudiation, which also includes services for authentication, auditing, and logging.

Digital signatures in online transactions make assurance that a party cannot later dispute the sending of information or the validity of its signature. Alice can encrypt the communication using her own Private Key. As a result, only her public key, which she is aware Bob (and everyone else) has access to, may be used to decrypt her message. Bob receives the message, and he uses Alice's public key to decrypt it. Secret key cryptography (symmetric encryption): To encrypt and decrypt given messages, both the sender and the receiver must use the same key.

Learn more about information here-

brainly.com/question/15709585

#SPJ4

6 0
1 year ago
__________ Refers to the difference between the original analog data and the approximation of that data using the techniques for
otez555 [7]

Answer:

Quantizing error

Explanation:

In digitisation of analog signal refers to the rounding off of values which are approximately equal to the analog signals. The method of sampling chooses a few point on the analog signal and then these points are joined to round off the value to a near stabilised value. such process is known as Quantization. For any system, during its functioning, there is always a difference in the values of its input and output. The processing of the system results in an error, which is the difference of those values.

The difference between an input value and its quantized value is called a Quantization Error. A Quantizer is a logarithmic function that performs Quantization rounding off the value. An analog-to-digital converter (ADC) works as a quantizer.

8 0
4 years ago
Please help!! thank you so much!! &lt;3
sasho [114]

Answer: <em>The kinetic energy of the 20 gram ball is half the kinetic energy of the 10 gram ball.</em>

<em />

Explanation: :)

7 0
3 years ago
Read 2 more answers
Other questions:
  • What will the output be from the following program?
    5·1 answer
  • How do you add a PDF assignment to google docs and be able to edit it?
    13·1 answer
  • After which stage in the information processing cycle can data be referred for future use?
    7·1 answer
  • What is the most difficult part of working with the Help system?
    8·1 answer
  • Gimme Shelter Roofers maintains a file of past customers, including a customer number, name, address, date of job, and price of
    8·1 answer
  • Discuss the DMA process​
    11·2 answers
  • How would you define the term technology
    8·1 answer
  • Which of the following is a system management tool?
    9·2 answers
  • Ninety percent of the fastest-growing jobs require some kind of postsecondary education.
    7·1 answer
  • Which of the following do nylon and Kevlar fibers have in common?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!