Skip to content

Instantly share code, notes, and snippets.

@imsardine
Last active August 29, 2015 14:13
Show Gist options
  • Save imsardine/562f2d580f5c36e8f4e9 to your computer and use it in GitHub Desktop.
Save imsardine/562f2d580f5c36e8f4e9 to your computer and use it in GitHub Desktop.
Programming
print [i for i in xrange(2000, 3200 + 1) if (i % 7 == 0 and i % 5 != 0)]
for x in range(1, 10): # [1..10)
print '\n{bar}{x:^3}{bar}'.format(bar='=' * 5, x=x)
for y in range(1, 10):
print '{x:>2} x {y:>2} = {xy:>3}'.format(x=x, y=y, xy= x * y)
# -*- coding: UTF-8 -*-
nums = dict(zip('0123456789', u'零一二三四五六七八九'))
def cnums(num):
return ''.join(map(lambda x: nums[x], str(num)))
for x in range(1, 10): # [1..10)
print u'\n{bar}{x:^3}{bar}'.format(bar='=' * 5, x=cnums(x))
for y in range(1, 10):
print u'{x}乘{y}等於{xy}'.format(x=cnums(x), y=cnums(y), xy= cnums(x * y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment