鱼C论坛

 找回密码
 立即注册
查看: 8396|回复: 17

[已解决]Python:每日一题 177

[复制链接]
发表于 2018-5-29 08:42:35 | 显示全部楼层
  1. strings = 'a,b,c,d,e;f,g,h,i,j;k,l,m,n,o;p,q,r,s,t'


  2. def matrix(string):
  3.     lst = string.split(';')
  4.     tmp = list(map(len, lst))

  5.     if sum(tmp) == tmp[0] * len(tmp):
  6.         for i in lst:
  7.             print('')
  8.             for j in i:
  9.                 if j != ',':
  10.                     print('{0:^2}'.format(j), end='')
  11.     else:
  12.         print('impossible')
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2026-4-1 20:23

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表