最新回答 / 流动的风与雪
以list作为参数将tuple类初始化,将返回tuple类型<...code...>以tuple作为参数将list类初始化,将返回list类型<...code...>
2019-05-11
if score>=90:
print 'excellent'
elif score>=80:
print 'good'
elif score>=60:
print 'passed'
else:
print 'failed'
python的语法都不用写成elif score>=80&&score<90 么
print 'excellent'
elif score>=80:
print 'good'
elif score>=60:
print 'passed'
else:
print 'failed'
python的语法都不用写成elif score>=80&&score<90 么
2019-05-11
for x in range(1, 9):
for y in range(x+1, 10):
print x*10 + y
for y in range(x+1, 10):
print x*10 + y
2019-05-10
最赞回答 / 慕容1441228
是否使用的是python3进行编程,python3中无cmp函数,需要引入模块>>>import operator然后调用相应operator.lt(a, b),还有其他对应的函数le,eq,ne,ge,gt;
2019-05-10
s = set(['adam','bart'])
print 'adam' in s
print 'bart' in s
print 'adam' in s
print 'bart' in s
2019-05-09
# -*- coding: utf-8 -*-
d = {
95:'Adam' ,
85:'Lisa',
59:'Bart'
}
print '95:\''+d.get(95)+'\''
d = {
95:'Adam' ,
85:'Lisa',
59:'Bart'
}
print '95:\''+d.get(95)+'\''
2019-05-09