d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
a = 0
for i in d.values():
sum +=i
a += 1
print sum/a
还是没有别人简单
sum = 0.0
a = 0
for i in d.values():
sum +=i
a += 1
print sum/a
还是没有别人简单
2018-07-23
t = ('a', 'b', ('A'), ('B'))
ptint t
ptint t
2018-07-23
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59,
'Paul': 75
}
print(len(d))
'Adam': 95,
'Lisa': 85,
'Bart': 59,
'Paul': 75
}
print(len(d))
2018-07-23
python 带坏了缩进的风气。用Tab可以满足2,4,8等任何缩进喜好的人群。强制空格了之后,都只能有一种风格了。喜欢2个缩进的人就只能用4个。。。保持一致就好,继续用tab飘过
2018-07-23
x1 = 1
d = 3
n = 100
x100 =n+n*(n-x1)/(d-x1)*d
s = x100
print s
不知道对不对,,,第一次玩
d = 3
n = 100
x100 =n+n*(n-x1)/(d-x1)*d
s = x100
print s
不知道对不对,,,第一次玩
2018-07-22
sum = 0
x = 1
n = 1
while True:
sum=sum+x
x=2*x
n=n+1
if n>20:
break
print sum
x = 1
n = 1
while True:
sum=sum+x
x=2*x
n=n+1
if n>20:
break
print sum
2018-07-22
sum=0
x=1
while x<100:
if x%2==1;
sum=sum+x
print sum;
x=x+1
x=1
while x<100:
if x%2==1;
sum=sum+x
print sum;
x=x+1
2018-07-21
sum = 0
x = 1
while x % 2 != 0
sum = sum + x
x = x + 1
print sum
x = 1
while x % 2 != 0
sum = sum + x
x = x + 1
print sum
2018-07-21
集合是指包含一组元素的数据结构,我们已经介绍的包括:
1. 有序集合:list,tuple,str和unicode;
2. 无序集合:set
3. 无序集合并且具有 key-value 对:dict
1. 有序集合:list,tuple,str和unicode;
2. 无序集合:set
3. 无序集合并且具有 key-value 对:dict