笨方法学习Python-习题24: 更多练习
来源:互联网 发布:星际老男孩淘宝店 整机 编辑:程序博客网 时间:2024/06/05 06:41
# coding=utf-8print("Let's practice everything.")print("You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.")poem = """\tThe lovely worldwith logic so firmly plantedcannot discern \n the needs of lovenor comprehend passion from intuitionand requires and explanation\n\t\twhere there is none."""print("------------------")print(poem)print("------------------")five = 10 - 2 + 3 - 6print("This should be five: %s" % five)def secret_formula(started): jully_beans = started * 500 jars = jully_beans / 1000 crates = jars / 100 return jully_beans,jars,cratesstart_point = 10000beans,jars,crates = secret_formula(start_point)#print(secret_formula(start_point))print("With a starting point of : %d" % start_point)print("We'd have %d beans,%d jars,and %d crates." %(beans,jars,crates))start_point = start_point / 10print("We can also do that this way:")print("We'd have %d beans.%d jars,and %d crates." %secret_formula(start_point))"""为什么你在后面把 jelly_beans 这个变量名又叫成了 beans ? 这是函数的工作原理。记住函数内部的变量都是临时的,当你的函数返回以后,返回值可以被赋予一个变量。我这里是创建了一个新变量,用来存放函数的返回值。 """
阅读全文
0 0
- 笨方法学习Python-习题24: 更多练习
- 笨方法学习Python-习题25: 更多更多的练习
- 笨方法学Python 习题 24: 更多练习
- 笨方法学Python 习题 25: 更多更多的练习
- 笨方法学习Python-习题7:更多打印
- 笨方法学习Python-习题17: 更多文件操作
- 习题24 更多练习
- 本方法学python 习题24(综合练习) 习题25(更多关于函数和变量的练习)习题26(修改程序)
- 笨方法学习Python-习题28: 布尔表达式练习
- 笨方法学习Python-习题5:更多的变量和打印
- 笨方法学Python 习题 7: 更多打印
- 笨方法学Python 习题 17: 更多文件操作
- Learn Python The Hard Way学习(24) - 更多的练习
- 笨方法学Python 习题 28: 布尔表达式练习
- 笨方法学习Python-习题11:提问
- 笨方法学习Python-习题42: 物以类聚
- 笨方法学习Python-习题43、44
- OC 学习 习题 更多
- mybatis学习心得
- day30
- Animation Starter Pack中动画蓝图事件添加的位置
- C#编写C/S端代码,Windows应用程序 --- 初接触(二)
- opencv-特征检测与描述
- 笨方法学习Python-习题24: 更多练习
- compileSdkVersion,minSdkVersion,targetSdkVersion还有buildToolsVersion的区别
- 洛谷 1250 种树
- HTML中有用的字符实体
- win下wampserver集成包配置多站点虚拟主机出现的问题(forbidden)
- C 结构体对齐
- 【BZOJ4010】【HNOI2015】菜肴制作(拓扑排序)
- bzoj 2330 糖果
- jq ajax