Computer Science, asked by nitya82hosur, 11 months ago

write a python program to print the following pattern 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

Answers

Answered by syed2020ashaels
0

Answer:

Given below is the code

Explanation:

import math

n = int(input)

for i in range (math.Ceil(n/2));

for j in range(1, n+1);

print( n*2*i + j, end =" ");

print ();

for i in range(n/2,0, -1);

for j in range ( 1, n+1);

print(n*(2*i-1) + j, end =" ");

print();

A high-level, all-purpose programming language is Python. Code readability is prioritised in its design philosophy, which makes heavy use of indentation. [32]

Python uses garbage collection and has dynamic typing. It supports a variety of programming paradigms, including procedural, object-oriented, and functional programming as well as structured programming (especially this). Due to its extensive standard library, it is frequently referred to as a "batteries included" language. [33] [34]

Python was created by Guido van Rossum in the late 1980s to replace the ABC programming language, and it was originally made available as Python 0.9.0 in 1991.

[35] New features like list comprehensions, cycle-detecting garbage collection, reference counting, and support for Unicode were added to Python 2.0, which was published in 2000. The 2008 release of Python 3.0 was a significant update that was only partially backwards compatible with previous iterations. The final release of Python was 2.7.18 in 2020.

Similar questions