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
In women’s tennis, a player must win 2 out of 3 sets to win a match. If a player wins the first 2 sets, she wins the match and t
fenix001 [56]

Answer:

1)All possible sequences of events V and M by set played that will result in Player V winning the match = VV; MVV; VMV

2) All possible sequences of events V and M by set played that will result in Player M winning the match:

MM; VMM; MVM

3) The probability player V wins the match = 0.4575

4) Probability that a match between Player V and Player M will consist of 3 sets given that Player V wins the match. = 0.3443

The expected number of sets played when Player V competes in a match with Player M = 2.35

Explanation:

Given:

Event player V wins a set = V

Event player M wins a set = M

1)All possible sequences of events V and M by set played that will result in Player V winning the match = VV; MVV; VMV

2) All possible sequences of events V and M by set played that will result in Player M winning the match:

MM; VMM; MVM

3) The probability player V wins the match:

P(V) = P(VV) + P(MVV) + P(VMV)

P(VV) means probability player V wins first and second set. In the first set she had an equal chance of winning, i.e 50%. We are told if she wins first set, probability of winning second set is 0.60.

Therefore, P(VV) = 0.50 * 0.60

= 0.30

P(MVV) means player V lost the first set, but won the remaining two sets.

P(MVV) = 0.50 *(1-0.70) * 0.45

= 0.0675

VMV means player V won the first set, lost the second, and won the third set.

P(VMV) = 0.50 * (1-0.60) * 0.45

= 0.09

Therefore

P(VV) + P(MVV) + P(VMV)

= 0.30 + 0.0675 + 0.09

= 0.4575

Probability V wins is 0.4575

4) Probability that a match between Player V and Player M will consist of 3 sets given that Player V wins the match.

Here it means player V must lose one of the first two sets, but will still win the match.

Calculating, we have:

\frac{P(MVV) + P(VMV)}{P(V)}

= \frac{0.0675 + 0.09}{0.4575}

= 0.344262 ≈ 0.3443

5) The expected number of sets played when Player V competes in a match with Player M.

Let's first find the probability 2 sets are played.

P(2) = P(VV) + P(MM)

We know P(VV) = 0.30

P(MM) = 0.50 * 0.70 = 0.35

Therefore, P(2) = 0.30 + 0.35

P(2)= 0.65

Let's now find probability of 3 sets happening.

P(3) = P(2) not happening

Therefore

P(3) = 1 - P(2)

P(3) = 1 - 0.65 = 0.35

Since probability of 2 sets is 0.65 and probability of 3 sets is 0.35, the expected number of sets will be :

(2 * 0.65) + (3 * 0.35)

= 1.30 + 1.05 = 2.35

The expected number of sets = 2.35

3 0
3 years ago
After being deployed and arrived on scene at an incident the first task for response personnel is to
Stolb23 [73]
Help the injured and do what they can to save lives
6 0
3 years ago
You may turn right on a red light ONLY if you are in the right-most lane, you're turning into the right-most lane on the cross r
Anna11 [10]
I believe the answer should be B.
3 0
3 years ago
Hiquehdiqushiuqehd9yed
Anna [14]

Answer:

what is the question?

Explanation:

do you need something translated?

3 0
3 years ago
Ballkan
ella [17]

Answer:

<h2>Pre delete mo tong acc. mo na toh "US" na Server toh ng App na toh kaya delete mo toh tapos Gawa ka ulit ng bago pre ganyan din nangyari sa akin nasa US server ako</h2>
4 0
3 years ago
Other questions:
  • Ywhat do teens get on their face if too much auger or no washing
    7·1 answer
  • Research indicates that excessive amounts of cortisol may result in the development of gigantism
    14·2 answers
  • What is the surface area of the given figure
    15·1 answer
  • Stefano paid 7$ per hour to rent a bicycle jordana paid$9 per hour to rent a if they both rent bycicles for 3 hours how much wil
    12·1 answer
  • A 1.0 x 10^2-kilogram box rests on the bed of a
    15·1 answer
  • What is a Llama??? Don’t mind me just conducting an experiment
    14·1 answer
  • Help pls
    9·1 answer
  • Doctors that take care of mental illness AND ABNORMAL BEHAVIOR
    13·1 answer
  • Who is this? help please​
    15·2 answers
  • What is are some differences between a teacher and a student?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!