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
What should we do to prevent software piracy?
frozen [14]

Answer:

1. Read the End User License Agreement (EULA) for each software product you purchase.

2. Purchase CD software only from reputable resellers.

3. Purchase software downloads directly from the manufacturer's website.

4. Register your software to prevent others from attempting to install your software on their computers.

5. Report piracy if you discover that software you purchased is not authentic or if you suspect that an online reseller or retail establishment is selling counterfeit software.

Link: https://www.techwalla.com/articles/how-to-stop-software-piracy

-Please mark as brainliest!- Thanks!

7 0
3 years ago
Which one of the following statements is true regarding the fetch-execute cycle? Each step of the fetch-execute cycle is perform
AfilCa [17]

Answer:

The device responsible for performing the fetch-execute cycle is the CPU.

Explanation:

The fetch execution cycle is the way or method the CPU executes instructions given to it. In this process or cycle, the CPU fetches the instruction, then decodes it, executes it, and stores the information in its database.

The CPU executes one instruction at a time.

8 0
4 years ago
Give an explanation of one network connection (it will every helpful​
charle [14.2K]

Answer:

WiFi, Ethernet, Broadband, Dial-up. Any of those.

Explanation:

Network connections are all different. Those listed are some of the many examples of network connections.

7 0
3 years ago
You can press the ____ keys to open the Format Cells dialog box.
Kobotan [32]
You can press the 1 + Control(CTRL).
4 0
3 years ago
Identify the first step in the process of setting margins.
olga55 [171]
Read the whole passage first then go back and the margin is supposed to be the main idea of the thing you are reding

7 0
4 years ago
Other questions:
  • Create a variable ‘temp’ and assign the value in Celsius. Display the message ‘It’s extremely hot day today!’ if the temperature
    8·1 answer
  • Once a graph has been created, you would need to start over to make any changes to it?
    5·1 answer
  • PLEASE HELP THIS IS MY LAST CHANCE TO PASS MY QUIZ
    13·2 answers
  • Ms. Myers commented that _____ she slept in at the hotel was better than _____ she slept in at home.
    7·1 answer
  • A company operates on two types of servers: 2 large servers (L) and 4 smaller servers (S), with a combined total of 64GB RAM. Th
    9·1 answer
  • Study the sentence below
    13·2 answers
  • Plz answer me will mark as brainliest​
    8·1 answer
  • Choose the assistive technology that best completes each sentence.
    13·1 answer
  • If you are to enhance the ICT used by your teachers, how will ypu do it? Will you use the same ICT or will you modify how it was
    11·1 answer
  • "using this type of communications channel, several users can simultaneously use a single connection for high-speed data transfe
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!