exercise 24 更多练习
2017-01-11 02:53
337 查看
print "Let's practice everything." print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.' poem = """ \tThe lovely world with logic so firmly planted cannot discern \n the needs of love nor comprehend passion from intuition and requires an explanation \n\t\twhere there is none. """ print "--------------" print poem print "--------------" five = 10 - 2 + 3 - 6 print "This should be five: %s" % five #此处直接显示5而不是上面的表达式/所以什么时候字符串 def secret_formula(started): jelly_beans = started * 500 jars = jelly_beans / 1000 crates = jars / 100 return jelly_beans, jars, crates start_point = 10000 beans, jars, crates = 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 / 10 print "We can also do that this way:" print "We'd have %d beans, %d jars, and %d crates." % secret_formula(start_point)
相关文章推荐
- 另类约瑟夫问题
- 205. Isomorphic Strings
- 2016年上海交通825软件工程研究生入学考试真题回忆
- 307. Range Sum Query - Mutable
- Vue学习笔记(2)模板的使用
- Zookeeper的单机模式搭建(一):
- 提高 Vim 使用效率的 12 个技巧
- 子字符查找KMP算法 - 子串自匹配索引表
- Maven+SpringMVC+Mybatis项目搭建(一)
- 写一个程序,统计自己C语言共写了多少行代码,Github基本操作
- Testing Round #13 C. Interactive Bulls and Cows (Hard) 枚举
- c程序第三篇3
- 如何获取Azure AD tenant的tenant Id?
- Linux高级文本处理之gawk内置变量(二)
- Netty实践(二):TCP拆包、粘包问题
- Android开发——单击事件和长按事件
- ORACLE 误删表、误删表数据后恢复
- javascript基础
- Vue学习笔记(1) 一开始的使用以及Vue实例的详解
- c程序第二篇2