score = 85
if score >= 90:
print 'excellent'
elif score >= 80 and score < 90:
print 'good'
elif score >= 70 and score < 80:
print 'passed'
else:
print 'failed'
if score >= 90:
print 'excellent'
elif score >= 80 and score < 90:
print 'good'
elif score >= 70 and score < 80:
print 'passed'
else:
print 'failed'
2015-03-14
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
2015-03-14
python函数返回多值返回的其实是一个tuple, 但是语法上,返回一个tuple可以省略括号,而多个变量可以同时接受一个tuple,按位置赋给相应的值。
2015-03-14
dict means dictionary in python, it's a kind of data structure! check it out here https://docs.python.org/2/tutorial/datastructures.html
2015-03-14