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]
2 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]2 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
Alejandra is using a flash drive that a friend gave to her to copy some financial records from the company database so she can c
Misha Larkins [42]

Answer:

maybe threat?

Explanation:

4 0
3 years ago
Which line in the following program contains the header for the showDub function? 1 #include 2 using namespace std; 3 4 void sho
Flura [38]

Answer:

The answer to this question is "15 line".

Explanation:

A function is a block of ordered, portable code used to perform a single, connected operation. The syntax of function declaration can be given as:

Syntax :

returntype functionName(parameter1, parameter2); //function prototype

or declaration

returntype functionName(parameter1, parameter2) //function definition or header of the function  

{  

//function body.

//function implementation

 //return value;

}

In the given question the header of the showDub function is on line 15.

That's why the answer to this question is "15 line".  

8 0
3 years ago
You have to display or connect to network shares on remote computers. Which command-line utility will you use to accomplish the
Xelga [282]

Answer:

net use X: \\SERVER\Share

Explanation:

1. Connect securely to the remote computer or ensure you have access to it on the network

2. then follow the step below:

Where X: is the drive letter you wish to map the share to, and \\SERVER\Share is the UNC path to the share. This should make the share visible in My Computer and the command line as well like all other shares mapped through the GUI.

In order to later disconnect the share, you would use

net use X: /delete

8 0
3 years ago
¿Cuales son las empresas mas exitosas que aún usan hoja de cálculo? porfa es urgentee
dem82 [27]

Answer:excel

Explanation:

6 0
2 years ago
Which button is used to open the Start menu in Windows Vista?
Karo-lina-s [1.5K]
The answer is B. Windows icon
4 0
3 years ago
Other questions:
  • When a relationship is established between two or more arrays by using the same subscript to relate entries between the arrays,
    14·2 answers
  • Which keyboard feature is a form feed character?
    14·1 answer
  • Given that the time to read data off a 7200 rpm disk drive will be roughly 75% of a 5400 rpm disk, at what idle time of the 7200
    13·1 answer
  • What is the Code of Conduct/Ethics for the company/of Department of Defense?
    7·1 answer
  • Can somebody explain me what this code does in a few or one sentence?#include #include using namespace std;int main () { const i
    12·1 answer
  • How to get bing with any node unblocker
    10·2 answers
  • Define management styles
    14·2 answers
  • A group of two or more computer systems linked together via communication devices is called:.
    10·1 answer
  • What are the minimum number of bits an address bus must have in a byte addressable memory system containing only 4 KiB of memory
    8·1 answer
  • Any changes done to the software during the operational phase of the software before project wind up is called as maintenance. S
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!