当前位置:网站首页>PTA (daily question) 7-70 diamond
PTA (daily question) 7-70 diamond
2022-07-29 00:22:00 【Little Deng programmer who can write bugs】
Enter an integer n, Output 2n-1 A diamond formed by rows , for example ,n=5 The diamond of is shown in the output sample .
Input format :
There are multiple sets of test data , Processing to the end of the file . Enter an integer for each set of tests n(3≤n≤20).
Output format :
For each group of test data , Output a total of 2n-1 Diamond of line , See the output example for details .
sample input :
5
sample output :
*
***
*****
*******
*********
*******
*****
***
*
Code :
try:
while True:
n = int(input())
for i in range(1, n+1):
for j in range(n-i):
print(' ', end='')
for k in range(2*i-1):
print('*', end='')
print()
for i in range(1,n):
for j in range(i):
print(' ', end='')
for k in range(2*(n-i)-1):
print('*', end='')
print()
except EOFError:
pass

边栏推荐
- Advanced area of attack and defense world web masters supersqli
- Kali installs burpsuite professional
- Sword finger offer 41. median in data flow
- Redis learning notes
- flyway的快速入门教程
- Control fillet stroke materialshapedrawable
- MySQL事务(transaction) (有这篇就足够了..)
- Develop effective Tao spell
- 2022 network security learning route is very detailed, recommended Learning
- 110道 MySQL面试题及答案 (持续更新)
猜你喜欢

Network traffic monitoring tool iftop

Application of Devops in Internet of things solutions

Virtual lab basic experiment tutorial -8. Fourier transform (1)

Plato farm is expected to further expand its ecosystem through elephant swap

Advanced area of attack and defense world web masters ics-06

MySQL安装配置教程(超级详细、保姆级)

12个MySQL慢查询的原因分析

Kali installs burpsuite professional

Field injection is not recommended solution

How can Plato obtain premium income through elephant swap in a bear market?
随机推荐
Leetcode64. Minimum path sum
面试被问到了String相关的几道题,你能答上来吗?
Erc20 Standard Code
Real time data warehouse: Didi's real-time data warehouse landing practice
Eye of depth (18) -- partial derivative
动态规划问题(三)
Locally connect to redis on Windows Server
Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R
1331. 数组序号转换 : 简单模拟题
DCAT in laravel_ Admin preliminary use record
MySQL installation and configuration tutorial (super detailed, nanny level)
熊市下PLATO如何通过Elephant Swap,获得溢价收益?
Detailed explanation of 9 common reasons for MySQL index failure
@Detailed explanation of the use of transactional annotation
Google browser, no installation required
CV target detection model sketch (2)
R语言怎么学
Camera Hal OEM模块 ---- cmr_preview.c
分布式限流 redission RRateLimiter 的使用及原理
With this, your messages can't be monitored