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 is the future of web development
Anna35 [415]

Answer:

Creating websites that can execute automated tasks and new programing languages revolving around web development.

Explanation:

7 0
2 years ago
Ok so another weird question! So if you know what google drive is and how to upload a video why does it keep adding hours! it ke
lesya [120]

Answer:Your video may be too long and you may not have that much storage left.

Explanation:

5 0
3 years ago
A text-only forum accessed through a bulletin board service (BBS) is known as a _____.
Tcecarenko [31]

Answer:

newsgroup---for apex

3 0
3 years ago
you are the it manager for your company. you have been asked to give the executive group the right to read, change, and assign p
inn [45]

The permission to give the executive group the right to read, change, and assign permissions to document is Give executive Change to shared permissions

<h3>What do you mean of executive?</h3>

An executive is seen as a kind of a powerful person  and they are the people that are known to be  responsible for making things go on or  run smoothly in any organization.

Therefore, The permission to give the executive group the right to read, change, and assign permissions to document is Give executive Change to shared permissions

Learn more about executive  from

brainly.com/question/838027

#SPJ1

5 0
2 years ago
Jennifer wants to improve her relationship with her customers.which of the following measurements should she work on improving?
igomit [66]
She should work on being nice to them
7 0
2 years ago
Other questions:
  • Can anyone help? Please.
    10·2 answers
  • When introducing new devices to the network, the organization's security policy requires that devices be monitored to establish
    15·1 answer
  • Which tab is used to edit objects on the slide master and layouts
    10·1 answer
  • Which access control principle specifies that no unnecessary access to data exists by regulating members so they can perform onl
    11·1 answer
  • What are the prime factorizations of 52 and 77? a. b.
    5·1 answer
  • Write a function that takes an integer value and returns the number with its digits reversed. for example, given the number 7631
    10·1 answer
  • Which of the following accurately describe the
    9·2 answers
  • Cursor/Blinking line is used to show current_ on document. A- Color b- Status c- Type d- Location
    11·1 answer
  • What is considered appropriate dress for men and women in the workplace? Select all that apply.
    6·2 answers
  • A ____________ protocol is software that provides or facilitates a connection in which no information is retained by either send
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!