L = [75, 92, 59, 68]
sum = 0.0
for score in L:
sum+=score
print sum / 4
sum = 0.0
for score in L:
sum+=score
print sum / 4
2015-12-21
score = 85
if score>=90:
print 'excellent'
elif score>=80:
print 'good'
elif score>=60:
print 'passed'
else:
print 'failed'
if score>=90:
print 'excellent'
elif score>=80:
print 'good'
elif score>=60:
print 'passed'
else:
print 'failed'
2015-12-21
score = 55
if score>=60:
print 'passed'
else:
print 'failed'
if score>=60:
print 'passed'
else:
print 'failed'
2015-12-21
a = 'python'
print 'hello,', a or 'world'
# a不是空字符串,为ture,所以在or运算直接输出a
b = ''
print 'hello,', b or 'world'
# b是一个空字符串,为false,所以在or运算输出结果必为'world'
print 'hello,', a or 'world'
# a不是空字符串,为ture,所以在or运算直接输出a
b = ''
print 'hello,', b or 'world'
# b是一个空字符串,为false,所以在or运算输出结果必为'world'
2015-12-21
#!/usr/bin/env python
# -*- coding: utf-8 -*-
a = 'python'
print 'hello,', a or 'world'
#输出 "hello," a 为True,直接输出a,不在计算后面的
#so,该句的输出为“hello, python”
b = ''
print 'hello,', b or 'world'
#输出 "hello," b为空值即False,短路计算原则,直接输出or后面的值"world"
#整句的输出就是“hello, world”
# -*- coding: utf-8 -*-
a = 'python'
print 'hello,', a or 'world'
#输出 "hello," a 为True,直接输出a,不在计算后面的
#so,该句的输出为“hello, python”
b = ''
print 'hello,', b or 'world'
#输出 "hello," b为空值即False,短路计算原则,直接输出or后面的值"world"
#整句的输出就是“hello, world”
2015-12-21
环境有问题哦
在自己的机器上是OK的
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u'''
静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
在自己的机器上是OK的
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u'''
静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2015-12-21