Created
May 26, 2013 14:27
-
-
Save anonymous/5652948 to your computer and use it in GitHub Desktop.
python 理解度チェーック 各出力を頭で考えた後に実行して答え合わせしてみてね!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Q.1 | |
print "trats"[::-1] | |
##Q.2 | |
print 8 not in range(7,8) | |
##Q.3 | |
print 0.0 is 0 | |
##Q.4 | |
print ' '.join(map(str, map(int, "1 2 3 4 5".split()))) | |
##Q.5 | |
a = {} | |
a['3'] = range(10) | |
a[3] = a["3"] | |
del a[3][8] | |
print a[str(3)][-2] | |
##Q.6 | |
print sum(x for x in xrange(100) if 3 < x < 5) | |
##Q.7 | |
t = lambda x: lambda y: x | |
print t(3)(4) | |
##Q.8 | |
a = "%s" | |
print a%a*5 | |
##Q.9 | |
for x in xrange(10): | |
if x > 20: | |
break | |
else: | |
print x, | |
print 10 | |
##Q.10 | |
print "finish" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment