d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:'+str(d['Adam'])
print 'Lisa:'+str(d.get('Lisa'))
print 'Bart:'+str(d.get('Bart'))
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'Adam:'+str(d['Adam'])
print 'Lisa:'+str(d.get('Lisa'))
print 'Bart:'+str(d.get('Bart'))
2020-01-31
简简单单地处理。
for x in range(1,10):
for y in range(x+1,10):
print x*10+y
range(x)=range(0,x)=[0,1,2,3,...,x-1]
for x in range(1,10):
for y in range(x+1,10):
print x*10+y
range(x)=range(0,x)=[0,1,2,3,...,x-1]
2020-01-31
for i in range(1,10):
for j in range(i+1,10):
print i*10+j
借鉴了楼下的思想
for j in range(i+1,10):
print i*10+j
借鉴了楼下的思想
2020-01-30
最新回答 / qq_慕移动8430113
def average(*args): s1=0.0 if len(args)==0: return s1 s1 = sum(args)*1.0/len(args) return s1print average()print average(1, 2)print average(1, 2, 2, 3, 4)
2020-01-27
def average(*args):
sum=0.0
if len(args)==0:
return sum
else:
for x in args:
sum+=x
return sum/len(args)
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
sum=0.0
if len(args)==0:
return sum
else:
for x in args:
sum+=x
return sum/len(args)
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2020-01-27