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
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
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
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
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
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
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
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
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
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