s = set([('Adam', 95), ('Lisa', 85), ('Bart', 59)])
for x in s:
print str(x[0]) + ':'+ str (x[1])
for x in s:
print str(x[0]) + ':'+ str (x[1])
s = set([('Adam', 95), ('Lisa', 85), ('Bart', 59)])
for x in s:
print str(x[0]) + ':'+ str (x[1])
for x in s:
print str(x[0]) + ':'+ str (x[1])
2019-02-28
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key ,value in d.items() :
print (str(key) + ':' + str(value))
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key ,value in d.items() :
print (str(key) + ':' + str(value))
2019-02-28
# -*- coding: utf-8 -*-
d = {
95: 'Adam',
85: 'Lisa',
59: 'Bart'
}
a = int(input ( '请输入分数:' ) )
if a == 95 :
print ('您的名字是:' + d[95])
elif a == 85 :
print ('你的名字是:' + d[85])
elif a == 59:
print ('你的名字是:' + d[59])
else :
print ('输入错误!')
d = {
95: 'Adam',
85: 'Lisa',
59: 'Bart'
}
a = int(input ( '请输入分数:' ) )
if a == 95 :
print ('您的名字是:' + d[95])
elif a == 85 :
print ('你的名字是:' + d[85])
elif a == 59:
print ('你的名字是:' + d[59])
else :
print ('输入错误!')
2019-02-28
sum = 0
x = 1
while x < 100:
x = x + 2
sum = sum + x
print sum
x = 1
while x < 100:
x = x + 2
sum = sum + x
print sum
2019-02-27
L = ['Adam', 'Lisa', 'Bart']
L[-1] = 'Adam'
L[0] = 'Bart'
print L
L[-1] = 'Adam'
L[0] = 'Bart'
print L
2019-02-27
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(2)
L.pop(2)
print L
L.pop(2)
L.pop(2)
print L
2019-02-27
L = ['Adam', 'Lisa', 'Bart']
L = L.insert(2,'Paul')
print L
L = L.insert(2,'Paul')
print L
2019-02-27
L = [95.5,85,59]
print L[0]
print L[1]
print L[2]
#print L[3]
print L[0]
print L[1]
print L[2]
#print L[3]
2019-02-27
l=[0]
k=1
while True:
k1=k*k
k+=1
l.append(k1)
if k>100:
break
print(sum(l))
k=1
while True:
k1=k*k
k+=1
l.append(k1)
if k>100:
break
print(sum(l))
2019-02-27
for x in [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:
continue
print x*10+y
for y in [0,1,2,3,4,5,6,7,8,9]:
if x>=y:
continue
print x*10+y
2019-02-27