- 博客(12)
- 收藏
- 关注
翻译 Learn Python The Hard Way-Ecercise36~40
Exercise36:设计和调试Exercise37:复习各种符号Exercise38:列表的操作ten_things = "Apples Oranges Crows Telephone Light Sugar"print "Wait there's not 10 things in that list, let's fix that."stuff
2014-01-25 21:23:42 741
翻译 Learn Python The Hard Way-Ecercise31~35
Exercise31:作出决定print "You enter a dark room with two doors. Do you go through door #1 or door #2?"door = raw_input("> ")if door == "1": print "There's a giant bear here eating a cheese cak
2014-01-25 15:30:46 978
翻译 Learn Python The Hard Way-Ecercise26~30
Exercise26:恭喜你,你现在可以考试了!def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return wordsdef sort_words(words): """Sorts the words."
2014-01-25 15:14:03 1037
翻译 Learn Python The Hard Way-Ecercise21~25
Exercise21:函数可以返回东西def add(a, b): #定义四则运算的函数 print "ADDING %d + %d" % (a, b) return a + bdef subtract(a, b): print "SUBTRACTING %d - %d" % (a, b) return a - bdef multiply(a, b): print "
2014-01-25 14:58:10 894
翻译 Learn Python The Hard Way-Ecercise16~20
Exercise16:读写文件from sys import argvscript, filename = argv #创建的文件名print "We're going to erase %r." % filenameprint "If you don't want that, hit CTRL-C (^C)."print "If you do want that, hit
2014-01-25 14:43:26 685
翻译 Learn Python The Hard Way-Ecercise11~15
Exercise11: 提问print "How old are you?",age = raw_input()print "How tall are you?",height = raw_input()print "How much do you weight?",weight = raw_input()print "So, you're %r old, %r tall and
2014-01-25 13:28:49 671
翻译 Learn Python The Hard Way-Ecercise6~10
Exercise6:字符串和文本x = "There are %d types of people." %10binary = "binary"do_not = "don't"y = "Those who know %s and those who %s." %(binary, do_not)print xprint yprint "I said: %r." %xpr
2014-01-25 11:58:24 838 1
翻译 Learn Python The Hard Way-Ecercise1~5
Exercise1:第一个程序print "Hello World!"print "Hello Again"print "I like typing this."print "This is fun."print "Yay! Printing."print "I'd much rather you 'not'."print 'I "said" do not touch th
2014-01-19 16:51:58 673
原创 Learn Python The Hard Way-笨方法学Python
在寒假之前就已经有自学Python的想法,这次也没有着急去图书馆借一大堆书回来看,因为每次放假从图书馆借的书回家后都没怎么碰……在知乎关于 Python 的经典入门书籍有哪些?上有人推荐Learn Python The Hard Way这个网站,网站的作者Zed.A.Shaw把Python的学习分成了50几个小的练习来进行,虽说是第一次碰到这种学习方式,但从期末考试的应试经验来讲,一边
2014-01-19 15:43:54 842
原创 简单枚举---从一数组中任取n个元素
在解决POJ753-Flip Games之前,我们先来看这样一个问题:给出一个数组a[6]={1,2,3,4,5,6},求从中任取n个元素的所有组合。如果任取1个元素,那么组合是:1 ,2 ,3 ,4 ,5 ,6。如果任取2个元素,那么组合是:1 2,1 3,1 4,1 5,1 6。 2 3,2 4,2 5,2 6。 3 4,3 5,3 6。 4 5,4
2013-12-02 14:25:19 3297
原创 POJ2965-The Pilots Brothers' refrigerator
DescriptionThe game “The Pilots Brothers: following the stripy elephant” has a quest where a player needs to open a refrigerator.There are 16 handles on the refrigerator door. Every handle can
2013-11-28 14:13:14 631
原创 暴力求解法--简单枚举
=_=转眼已经大二了,大一的时候浪费了很多时间,折腾了一溜够后,痛定思痛,打算向林文学长学习,从C语言+数据结构+算法入手,打好基础,练好基本功并积累一定的代码量,为以后的学习做好准备。当然了,现在说的想的都还很肤浅,等时间充裕了后再静下心来慢慢梳理。在刚刚开始准备学习些算法之前,网络上很多算法进阶攻略都会建议先从一些简单的基本算法着手入门(),其中包括“枚举·贪心·递归和分治·递推·构造·模
2013-11-26 12:37:44 1534
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人