print 'hello ,python'
print 'hello',',','python'
print 'hello,''python'
print 'hello',',','python'
print 'hello,''python'
2018-05-30
print 'hello ,python'
print 'hello',',','python'
print 'hello,''python'
print 'hello',',','python'
print 'hello,''python'
2018-05-30
print [m*100+n*10+k for m in range(1,10) for n in range(0,10) for k in range(1,10) if m==k]
2018-05-30
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for v in d.itervalues():
sum+=v
print sum*1.0/len(d)
sum = 0.0
for v in d.itervalues():
sum+=v
print sum*1.0/len(d)
2018-05-30
def average(*args):
s=0
index=0
for number in args:
s+=number
index+=1
if index==0:
return 0.0
return s*1.0/index
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
s=0
index=0
for number in args:
s+=number
index+=1
if index==0:
return 0.0
return s*1.0/index
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2018-05-30
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for i in d:
print '%s:%d'%(i,d.get(i))
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for i in d:
print '%s:%d'%(i,d.get(i))
2018-05-28
def firstCharUpper(s):
return s[0:1].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
return s[0:1].upper()+s[1:]
print firstCharUpper('hello')
print firstCharUpper('sunday')
print firstCharUpper('september')
2018-05-28