当前位置:网站首页>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

边栏推荐
- Develop effective Tao spell
- Everything you have learned will come in handy at some point in your life (turn)
- Software designer - intermediate, exam summary
- MySQL installation and configuration tutorial (super detailed, nanny level)
- MySQL的存储过程
- “Method Not Allowed“,405问题分析及解决
- Sword finger offer 64. find 1+2+... +n, logical operator short circuit effect
- 研发效能的道法术器
- Oracle超全SQL,细节狂魔
- 乱打日志的男孩运气怎么样我不知道,加班肯定很多!
猜你喜欢

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

【微服务~Nacos】Nacos服务提供者和服务消费者

还在写大量 if 来判断?一个规则执行器干掉项目中所有的 if 判断...

Eye of depth (18) -- partial derivative

Intelligent trash can (VII) -- Introduction and use of sg90 steering gear (Pico implementation of raspberry pie)

AutoCAD -- import excel tables into CAD and merge CAD

12个MySQL慢查询的原因分析

vscode下链接远程服务器安装插件失败、速度慢等解决方法

Exchange 2013 SSL certificate installation document

Event extraction and documentation (2008-2017)
随机推荐
Solution: direct local.Aar file dependencies are not supported when building an aar
还在写大量 if 来判断?一个规则执行器干掉项目中所有的 if 判断...
动态规划问题(六)
@Detailed explanation of the use of transactional annotation
Where is sandbox's confidence in rejecting meta's acquisition of meta universe leader sand?
Detailed principle explanation and verification results of digital clock based on FPGA
Api 接口优化有哪些技巧?
Advanced area of attack and defense world web masters warmup
"Method not allowed", 405 problem analysis and solution
Real time data warehouse: Netease strictly selects the practice of real-time data warehouse based on Flink
Idea connection database
CV target detection model sketch (2)
@PostConstruct注解详解
NPM replace the latest Taobao image
CV semantic segmentation model sketch (2)
feign调用不通问题,JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r
Attack and defense world web master advanced area web_ php_ unserialize
pnpm的安装与使用
@Transactional 注解使用详解
#{}和${}的区别