Python学习笔记一
来源:互联网 发布:北航软件学院导师 编辑:程序博客网 时间:2024/05/01 23:46
要实现的效果如下图所示:
我用的Python3.5版本,程序代码如下:
#!/usr/bin/env python3.5sentence = input("Sentence: ")text_width = len(sentence)box_width = text_width + 8screen_width = 8whole_width = 2 * text_widthleft_width = (whole_width - box_width) // 2print(' ' * screen_width + '+' + '-' * whole_width + '+')print(' ' * (screen_width + left_width) + '|' + ' ' * box_width + '|' + ' ' * left_width)print(' ' * (screen_width + left_width) + '|' + ' ' * 4 + sentence + ' ' * 4 + '|' + ' ' * left_width)print(' ' * (screen_width + left_width) + '|' + ' ' * box_width + '|' + ' ' * left_width)print(' ' * screen_width + '+' + '-' * whole_width + '+')
0 0
- Python学习笔记(一)
- Python学习笔记[一]
- Python学习笔记一
- python学习笔记(一)
- Python学习笔记(一)
- Python学习笔记一
- python学习笔记一
- python 学习笔记一
- python 学习笔记一
- python学习笔记: 一
- python学习笔记(一)
- Python学习笔记(一)
- python学习笔记一
- python学习笔记一
- Python学习笔记一
- Python学习笔记一
- Python学习笔记一
- python学习笔记一
- 设计模式----python版本
- mac下运行.bin文件
- Socket描述符选项[SOL_SOCKET]
- 排序算法
- Mysql复习--添加字段,删除字段,一次多行插入,修改字段名和类型,分组查询,建类似表,
- Python学习笔记一
- 安装SQL2005 SP4补丁报错:无法安装Windows Installer MSP文件
- iGrimace iOS7-Ios8-ios一键新机 系统 NZT NEO 非V8锤子IG基本操作全教程:v3 v8
- 从svn中检出maven工程,导入到eclipse遇到的问题
- 花10钟看一看少走30年弯路
- leetcode-java-357. Count Numbers with Unique Digits
- windows对象的属性
- 两年多工作心得和体会
- 概率图模型(03): 模板模型(动态贝叶斯, 隐马尔可夫和Plate模型)