码迷,mamicode.com
首页 >  
搜索关键字:exercise 1-2    ( 479个结果
Exercise 30: Else And If
if __name__ == '__main__': a = 100 if a > 90: print "90" elif a > 80: print '80' elif a > 70...
分类:其他好文   时间:2014-10-24 18:04:50    阅读次数:202
Exercise 29: What If
people = 20cats = 30dogs = 15if people cats: print "Not many cats! The world is saved!"if people dogs: print "The world is dry!"dogs += 5if people...
分类:其他好文   时间:2014-10-24 18:01:42    阅读次数:159
Exercise 25: Even More Practice
def break_words(stuff): """This function will break up words for us.""" words = stuff.split(' ') return wordsdef sort_words(words): """Sorts t...
分类:其他好文   时间:2014-10-24 16:26:57    阅读次数:166
Exercise 24: More Practice
print "Let's practice everything." print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'poem = """\tThe lovely worldwith...
分类:其他好文   时间:2014-10-24 16:18:47    阅读次数:161
Codeforces Round #242 (Div. 2) A. Squats
Pasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and each hamster either sat down or stood up. For another exercise, Pasha n...
分类:其他好文   时间:2014-10-24 11:06:01    阅读次数:238
Exercise 19: Functions And Variables
def cheese_and_crackers(cheese_count, boxes_of_crackers): print "You have %d cheeses!" % cheese_count print "You have %d boxes of crackers!" % boxes.....
分类:其他好文   时间:2014-10-24 10:51:29    阅读次数:121
Exercise 21: Functions Can Return Something
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): ...
分类:其他好文   时间:2014-10-24 10:47:09    阅读次数:243
Exercise 20: Functions And Files
from sys import argvscript, input_file = argvdef print_all(f): print f.read() def rewind(f): f.seek(0)def print_a_line(line_count, f): pri...
分类:其他好文   时间:2014-10-24 10:25:01    阅读次数:253
Exercise 17: More Files
from sys import argv from os.path import existsscript, from_file, to_file = argvprint "Copying from %s to %s" % (from_file, to_file)# we could do thes...
分类:其他好文   时间:2014-10-23 22:37:21    阅读次数:324
Exercise 16: Reading And Writing Files
from sys import argvscript, filename = argvprint "We're going to erase %r." % filename print "If you don't want that, hit CTRL-C (^C)." print "If you ...
分类:其他好文   时间:2014-10-23 22:34:53    阅读次数:298
479条   上一页 1 ... 42 43 44 45 46 ... 48 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!