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
Juliette [100K]
4 years ago
14

Write a program that displays, 10 numbers per line, all the numbers from 100 to 200 that are divisible by 5 or 6, but not both.

The numbers are separated by exactly one space
My Code:
count = 0
for i in range (100, 201):
if (i %6==0 and i %5!=0) or (i%5==0 and i%6!=0):
print(str(i), "")
count = count + 1
if count == 10:
string = str(i) + str("")
print(string)
count = 0
Any way to put the numbers 10 per line?

Computers and Technology
1 answer:
FromTheMoon [43]4 years ago
7 0

Answer & Explanation:

To print 10 on a line and each number separated by space; you make the following modifications.

print(str(i)+" ",end=' ')

str(i)-> represents the actual number to be printed

" "-> puts a space after the number is printed

end = ' ' -> allows printing to continue on the same line

if(count == 10):

     print(' ')

The above line checks if count variable is 10;

If yes, a blank is printed which allows printing to start on a new line;

The modified code is as follows (Also, see attachment for proper indentation)

count = 0

for i in range(100,201):

     if(i%6 == 0 and i%5!=0) or (i%5 ==0 and i%6!=0):

           print(str(i)+" ",end=' ')

           count = count + 1

           if(count == 10):

                 print(' ')

                 count = 0

You might be interested in
Name this:<br><br>Software that allows us to create dynamic slide presentations. ​
PtichkaEL [24]
I think it is presentation
4 0
3 years ago
Output the following 21%4​
Vadim26 [7]
21%4 is 1.

21-4=17
17-4=13
13-4=9
9-4=5
5-4=1
4 0
3 years ago
High-speed memory that reduces the frequency of access by the CPU to conventional memory is called: a. local memory b. cache mem
mestny [16]

Answer:

B. Cache memory.

Explanation:

A cache memory, a special type of random access memory, is a memory that is easily accessibly by a system's CPU (or microprocessor) more quickly than even the regular random access memory. It serves as a buffer between the RAM and the processor. Frequently and commonly used data, programs and applications are temporarily stored in the cache memory so that they are readily accessible and available to the processor. It is as a matter of fact the fastest memory in a computer.

The cache memory comes in three levels - L1, L2 and L3.

L1 cache are often built into the computer's core(s). They are generally small in size between 8KB and 64KB.

L2 and L3 caches are larger than the L1 cache and most times are separate from the CPU.

7 0
4 years ago
How are babys made nnnnnnnnnnnnnnnnn
elena-s [515]
Sex sex
Sex
Sex
Sex
Sex
3 0
3 years ago
A computer has a CPU that can execute 10 million instructions per second and a memory has a transfer rate of 100 million bytes p
asambeis [7]

Answer:

2 x 10⁵ bytes per second

Explanation:

Given:

MIPS rate = maximum speed of CPU to execute instructions = 10 million instructions per seconds

number of instructions required to transfer 1 byte using interrupt driven I/O = 50

Maximum number of bytes that can be transferred in 1 second = MIPS rate / number of instructions for 1 byte

=> max number of bytes = 10 million / 50 = 10 x 10⁶ / 50 = 2 x 10⁵

which is less than the maximum transfer rate of memory = 100 million bytes per second

So, maximum data transfer rate during I/O operations by using interrupt-driven I/O is 2 x 10⁵ bytes per second

8 0
3 years ago
Other questions:
  • Floppy disks hold more data than a CD-R/RW.<br> true or false?
    8·2 answers
  • What is a Boolean Expression?
    12·1 answer
  • The major difference between a template and another document is in.​
    11·1 answer
  • The area that holds all the startup instructions the computer needs to start is the
    7·1 answer
  • Java write code that inserts useritems into the output string stream itemsoss until the user enters "exit". each item should be
    14·2 answers
  • Cindy visits her favorite website on a lunch break using a hospital computer. After she downloads a file, she notices that the c
    7·1 answer
  • All of these acts performed when doing an oil and filter change except ?
    9·2 answers
  • What determines WiFi speeds, please list all your answers and explain how it affects the WiFi speed.
    8·1 answer
  • Give an example of how loops are used in programming Kturtle​
    7·1 answer
  • Task 2
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!