我执行了下面一段代码:
a = 'python'
print 'hello,', a or 'world'
b = ''
print 'hello,', b or 'world'
c = 'python'
print 'hello,', c and 'world'
d = ''
print 'hello,', d and 'world'
执行结果如下:
hello, python
hello, world
hello, world
hello,
a = 'python'
print 'hello,', a or 'world'
b = ''
print 'hello,', b or 'world'
c = 'python'
print 'hello,', c and 'world'
d = ''
print 'hello,', d and 'world'
执行结果如下:
hello, python
hello, world
hello, world
hello,
2020-03-02
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for i in d.values():
sum=sum+i
s=sum*1.0/len(d)
print s
sum = 0.0
for i in d.values():
sum=sum+i
s=sum*1.0/len(d)
print s
2020-03-01
个人觉得挺好(~ ̄▽ ̄)~
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
print sum(d.values())/(len(d)*1.0)
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
print sum(d.values())/(len(d)*1.0)
2020-03-01