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
ad-work [718]
3 years ago
13

Write code which prints every number from 1 to 20 a number of times equal to the number itself (e.G. One 1, two 2's...). Every i

ndividual number printed should be separated by a space, and there should be a new line each time the number changes. You should use nested loops to produce your output (it will result in far less code).
Advanced Placement (AP)
1 answer:
madreJ [45]3 years ago
8 0

Answer:

Answered in Python

for i in range(21):

    for j in range(i):

         print(i, end=' ')

    print(" ")

Explanation:

This iteration iterates from 1 to 20

for i in range(21):

This iteration iterates from 1 to current number

   for j in range(i):

This prints the current number in the a number of times equal to itself

       print(i, end=' ')

This enables printing on new line

   print(" ")

You might be interested in
List and explain the three principles that describe how the economy as a whole works
Firlakuza [10]
The three principles that describe how the economy as a whole works are: (1) a country's standard of living depends on its ability to produce goods and services; (2) prices rise when the government prints too much money; and (3) society faces a short-run tradeoff between inflation and unemployment.
6 0
3 years ago
FLINT WATER QUESTIONS PLEASE ANSWER ALL ;) <3
Flura [38]
Bro lead can’t oxidize what is your teacher doin
5 0
3 years ago
Energy = Force x Distance. Gravitational potential energy = Force (weight) x Height of the object above the ground. If a waterme
Pani-rosa [81]

Answer: 56 Joules beacuse the answers is 56 Joules this proves that its 98 Newtons

You are welcome

7 0
3 years ago
32 on the 4th ya know
spayn [35]

Answer:

736749 and a half uwu

Explanation:

4 0
4 years ago
Read 2 more answers
Mr. Harris stated that the moon and the earth formed at the same time from dust from the solar nebula. He is describing which th
sertanlavr [38]
Its the coformation theory, stating that the earth and moon were both made around the same time from a small dust particle
8 0
4 years ago
Read 2 more answers
Other questions:
  • Why want Mozart employed more by the aristocracy to compose music
    15·1 answer
  • Is Jesus a prophet according to Islam?
    8·2 answers
  • Describe the reliability of our data
    12·2 answers
  • Too much logging in the Oyamel fir forests could lead to the eastern monarch butterfly going extinct because _______.
    14·1 answer
  • Which of the following types of accounts should you not put money into that is being saved for a down payment on a house?
    15·2 answers
  • What is the iupac name for the following compound? ch3−ch2−ch2−ch2−ch2−ch2−ch2−ch2−ch3
    11·1 answer
  • Is there any evidence that we might have a natural understanding of moral values?
    6·1 answer
  • Ang lalaki ay magbabayad ng bride price para sa babaeng kanilang mapapangasawa saan patatagpuan
    9·1 answer
  • Describe the responsibilities held by state judicial systems, including the requirements set for state judges
    9·1 answer
  • A(n) blink is a drug that mimics or increases a neurotransmitters effects
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!