arrow_forward همه ارسال‌ها

جزئیات ارسال کد#626

code_blocks
مسئله مربوطه: الماس (#35) arrow_outward
verified
وضعیت داوری نهایی: پذیرفته شد
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
samin feizy (۱ سال پیش)
descriptionsolution.py ۲۲ خط • ۴۸۸ بایت
1# x = 5
2# * 01*34 i = 0 / j = 2
3# *** 0***4 i = 1 / j = 123
4# ***** ***** i = 2 / j = 01234
5# *** 0***4 i = 3 / j = 123
6# * 01*34 i = 4 / j = 2
7
8
9def dimond():
10 x = abs(int(input()))
11 y = x//2
12
13 for i in range(x):
14 for j in range(x):
15 if abs(i - y) + abs(j - y) <= y:
16 print("*", end = "")
17 else:
18 print(" ", end = "")
19 print()
20 return()
21
22dimond()
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8