会员
周边
新闻
博问
AI培训
云市场
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
普奕天
博客园
首页
新随笔
联系
订阅
管理
2018年12月24日
随笔
摘要: >>> players = ['charles', 'martina', 'michael', 'florence', 'eli'] >>> print(players[0:3]) ['charles', 'martina', 'michael'] >>> print([2:4]) SyntaxError: invalid syntax >>> print([2:4]) SyntaxError:.
阅读全文
posted @ 2018-12-24 11:52 普奕天
阅读(66)
评论(0)
推荐(0)
编辑
2018年12月18日
列表
摘要: bicycles = ['trek','cannondale','redline','specialized'] print(bicycles) >>> bicycles = ['trek','cannondale','redline','specialized'] >>> message = "My first bicycle was a "+ bicycles[0].title() + "...
阅读全文
posted @ 2018-12-18 11:00 普奕天
阅读(73)
评论(0)
推荐(0)
编辑
2018年12月15日
修改字符串大小写
摘要: name = "ada lovelace" print(name.title()) Ada Lovelace name2 = "Ada Lovelace" print(name2.upper()) ADA LOVELACE print(name2.lower()) ada lovelace firstname = "ada" lastname = "lovelace" fullname =...
阅读全文
posted @ 2018-12-15 10:23 普奕天
阅读(185)
评论(0)
推荐(0)
编辑
2018年7月22日
格式化输出
摘要: name = input("请输入姓名:") age = input("请输入年龄:") height = input("请输入身高:") msg = "我叫%s,今年%s岁,身高%scm" %(name,age,height) print(msg) name = input('请输入姓名:') age = input('请输入年龄:') job = input('请输入工作:') ho...
阅读全文
posted @ 2018-07-22 10:23 普奕天
阅读(75)
评论(0)
推荐(0)
编辑
1-2+3-4......99
摘要: sum = 0 count = 1 while count < 100: if count % 2 == 0 : sum = sum - count else: sum = sum + count count += 1 print(sum)
阅读全文
posted @ 2018-07-22 09:45 普奕天
阅读(154)
评论(0)
推荐(0)
编辑
1-99求和
摘要: sum = 0 count = 1 while count <= 100: sum = sum + count count += 1 print(sum)
阅读全文
posted @ 2018-07-22 09:16 普奕天
阅读(339)
评论(0)
推荐(0)
编辑