• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Jun 19th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. n = int(input("Setirler: "))
2. m = int(input("Sutunlar: "))
3. print()
4.
5. blank = "{:3}".format("_")
6. plot = [[blank for _ in range(m)] for _ in range(n)]
7.
8. for i in range(len(plot)):
9.     print(*plot[i])
10. print()
11. print()
12. x = 0
13. y = 0
14. number = 1
15. nform = "{:3}".format(number)
16.
17. while True:
18.     if plot[x][y] == blank:
19.         plot[x][y] = "{:3}".format(number)
20.         number += 1
21.
22.     try:
23.         if plot[x + 1][y] == blank:
24.             x += 1
25.             plot[x][y] = "{:3}".format(number)
26.             number += 1
27.     except IndexError:
28.         try:
29.             if plot[x][y + 1] == blank:
30.                 y += 1
31.                 plot[x][y] = "{:3}".format(number)
32.                 number += 1
33.         except IndexError:
34.             break
35.     try:
36.         while plot[x - 1][y + 1] == blank and x - 1 >= 0:
37.             y += 1
38.             x -= 1
39.             plot[x][y] = "{:3}".format(number)
40.             number += 1
41.     except IndexError:
42.         pass
43.     try:
44.         if plot[x][y + 1] == blank:
45.             y += 1
46.             plot[x][y] = "{:3}".format(number)
47.             number += 1
48.     except IndexError:
49.         try:
50.             if plot[x + 1][y] == blank:
51.                 x += 1
52.                 plot[x][y] = "{:3}".format(number)
53.                 number += 1
54.         except IndexError:
55.             break
56.     try:
57.         while plot[x + 1][y - 1] == blank and y - 1 >= 0:
58.             y -= 1
59.             x += 1
60.             plot[x][y] = "{:3}".format(number)
61.             number += 1
62.     except IndexError:
63.         pass
64.
65. for i in range(len(plot)):
66.     print(*plot[i])
67. print()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top