s = set(['Adam', 'Lisa', 'Paul'])
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for strs in L:
tag=0
for name in s:
if strs==name:
s.remove(strs)
tag=1
break
if tag==0:
s.add(strs)
print s
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for strs in L:
tag=0
for name in s:
if strs==name:
s.remove(strs)
tag=1
break
if tag==0:
s.add(strs)
print s
2019-03-31
s = set([('Adam', 95), ('Lisa', 85), ('Bart', 59)])
for x in s:
print x[0]+':',x[1]
for x in s:
print x[0]+':',x[1]
2019-03-31
print r'''"To be, or not to be": that is the question.
Whether it's nobler in the mind to suffer.'''
Whether it's nobler in the mind to suffer.'''
2019-03-31
def average(*args):
sum=0.0
if len(args)==0:
return sum
else :
for x in args:
sum=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=sum+x
return sum/len(args)
print average()
print average(1, 2)
print average(1, 2, 2, 3, 4)
2019-03-30
print [int(str(m)+str(n)+str(m)) for m in range(1,10) for n in range(0,10)]
2019-03-30
for x in [0,1,2,3,4,5,6,7,8,9]:
for y in [0,1,2,3,4,5,6,7,8,9]:
if x<y:
print(10*x+y)
else:
continue
for y in [0,1,2,3,4,5,6,7,8,9]:
if x<y:
print(10*x+y)
else:
continue
2019-03-29