Love丶FFC's Blog
美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014 年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧!
输入在一行中给出正方形边长 N(3≤N≤20)和组成正方形边的某种字符 C,间隔一个空格。
输出由给定字符 C 画出的正方形。但是注意到行间距比列间距大,所以为了让结果看上去更像正方形,我们输出的行数实际上是列数的 50%(四舍五入取整)。
10 a
aaaaaaaaaa
a a
a a
a a
aaaaaaaaaa
1.先求出行数和列数
2.循环输出字符,首行、末行输出整行,其它行只输出首列、末列,中间用空格补齐
SideLength, Character = input().split() # 输入边长及字符 SideLength = int(SideLength) # 将字符型转为整型 ColumnLength = SideLength # 列数,等于边长 RowLength = float(SideLength) * 0.5 # 四舍五入算法 if RowLength - int(RowLength) >= 0.5: # 小数值大于等于0.5 RowLength += 1 RowLength = int(RowLength) for i in range(RowLength): # 按行输出 if i == 0 or i == RowLength - 1: # 首行或末行 for j in range(ColumnLength): # 输出整行 print(Character, end='') else: print(Character, end='') print((ColumnLength - 2) * ' ', end='') # 补足中间的空格 print(Character, end='') print() # 换行
fruinly
Shin A, Shu XO, Cai Q, Gao YT, Zheng W generic cialis no prescription
original louis vuittons outlet
I just wanted to thank you for the fast service. or possibly they look great. I received them a day earlier than expected. particularly I will definitely continue to buy from this site. you decide I will recommend this site to my friends. Thanks!
original louis vuittons outlet https://www.louisvuittonsoutletstore.com/
cheap louis vuitton outlet
I just wanted to thank you for the fast service. as well as they look great. I received them a day earlier than expected. which include the I will definitely continue to buy from this site. manner in which I will recommend this site to my friends. Thanks!
cheap louis vuitton outlet https://www.bestlouisvuittonoutlet.com/
cheap retro jordans
I just wanted to thank you for the fast service. to they look great. I received them a day earlier than expected. much like the I will definitely continue to buy from this site. an invaluable I will recommend this site to my friends. Thanks!
cheap retro jordans https://www.realcheapretrojordanshoes.com/
cheap retro jordans
I just wanted to thank you for the fast service. or maybe they look great. I received them a day earlier than expected. choose to I will definitely continue to buy from this site. either way I will recommend this site to my friends. Thanks!
cheap retro jordans https://www.realjordansretro.com/
FoorryNox
where to buy cialis I know how badly you would like to be able to restore her quality of life
cheap retro jordans
Read reviews and was a little hesitant since I had already inputted my order. as well but thank god, I had no issues. cherish the received item in a timely matter, they are in new condition. you ultimately choose so happy I made the purchase. Will be definitely be purchasing again.
cheap retro jordans https://www.cheapauthenticjordanshoes.com/
cheap jordans online
Read reviews and was a little hesitant since I had already inputted my order. alternatively but thank god, I had no issues. similar to the reduction received item in a timely matter, they are in new condition. in either case so happy I made the purchase. Will be definitely be purchasing again.
cheap jordans online https://www.realjordansshoes.com/
Preliaf
Malinoski, DJ, Slater, MS, Mullins, RJ propecia success rate In models of chemoresistant breast and ovarian cancer, ABC29460 decreases cell survival in a dose dependent manner