def count():
fs = []
for i in range(1, 4):
def f():
return i*i
fs.append(f())
return fs
f1, f2, f3 = count()
print f1, f2, f3
蛋疼,烧脑,会掉头发的
fs = []
for i in range(1, 4):
def f():
return i*i
fs.append(f())
return fs
f1, f2, f3 = count()
print f1, f2, f3
蛋疼,烧脑,会掉头发的
2018-05-17
def count(list):
fs = []
for i in list:
def f(j):
def g():
return j*j
return g
fs.append(f(i))
return fs
f1, f2, f3 = count(range(1, 4))
print f1()
print f2()
print f3()
fs = []
for i in list:
def f(j):
def g():
return j*j
return g
fs.append(f(i))
return fs
f1, f2, f3 = count(range(1, 4))
print f1()
print f2()
print f3()
2018-05-17
def paixu(x,y):
if x.upper()>y.upper():
return 1
if x.upper()<y.upper():
return -1
return 0
print sorted( ['bob', 'about', 'Zoo', 'Credit'],paixu)
if x.upper()>y.upper():
return 1
if x.upper()<y.upper():
return -1
return 0
print sorted( ['bob', 'about', 'Zoo', 'Credit'],paixu)
2018-05-17
import math
def isint(x):
return math.sqrt(x) in range(1,100)
print filter(isint,range(1,101))
def isint(x):
return math.sqrt(x) in range(1,100)
print filter(isint,range(1,101))
2018-05-17
廖老师的意思是,在class内部直接print实例个数,证明能在内部访问,外部print时会报AttributeError
2018-05-16
import os
print not(os.path.isdir(r'C:\Windows'))
print not(os.path.isfile(r'C:\Windows\notepad.exe'))
print not(os.path.isdir(r'C:\Windows'))
print not(os.path.isfile(r'C:\Windows\notepad.exe'))
2018-05-16
s = Student('Bob', -99)也可以运行,即初始化并没有限制成绩的输入,只限定了后续的赋值。
2018-05-15
那些动不动就给差评的,老师没讲的你们不会去查吗?以后工作也会遇到很多不懂的东西,那你们怎么办?查找解决问题的方法和自我学习是一名程序员的必备技能啊。又不是小学生了,何况人家廖大也没收你们钱,你们有这时间给差评还不如自己动手去查一下呢
2018-05-15