Computer Science, asked by Anonymous, 12 days ago

Question for python experts:

Print a pattern of series of number as below by using python loop:
1
1
2
2
3
3
4
4
5
5
And so on upto 10.

Answers

Answered by Najibm5441
0

Answer:

Copyshops (like Staples and Kinkos) are stores that have large format printers that are able to print really big sheets of paper—ones that are several feet long and several feet wide. Printers of that size are great for printing posters, blueprints, and of course, sewing patterns.

Explanation:

Answered by anindyaadhikari13
3

Answer:

This is your required co‎de for the question. If you want to print the numbers in different lines, just write - print(a)

n=int(input("Enter n - "))

a=c=1

for i in range(n):

   print(a, end=" ")

   c+=1

   if c>2:

       a+=1

       c=1

Here, initial values of a and c (counter) is 1. The loop starts and the value of a is printed. Then, the value of counter is incremented by 1. When the value of the counter variable becomes greater than 2, it is confirmed that the first number is printed twice. So, in that case, value of variable a is incremented by 1. Again, value of c becomes 1 and this continues.

See the picture for output.

Attachments:
Similar questions