为了账号安全,请及时绑定邮箱和手机立即绑定
num=0
sum=0
while True:
if num>1000:
break
sum=sum+num
num+=2
print(sum)
#这样也可以
a = r''''\"To be,or not to be\":that is the question.\n
Whether it\'s nobler in the mind to suffer.'
'''
print(a)
答案应该是:
s1 = 'ABC'
s2 = '123'
s3='xyz'
for z in s3:
for x in s1:
for y in s2:
print(x + y+ z);
print(x + z+ y);
print(y + x+ z);
print(y + z+ x);
print(z + x+ y);
print(z + y+ x);
# Enter a code
L = [75, 92, 59, 68, 99]
sum = 0.0
for s in L:
sum = sum + s

ave = sum / len(L)
print(ave)
# 输出hello,python
# 因为a是true,得到结果所以不往下进行
# Enter a code
names = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
names.append('Zero')
names.insert(-2,'Gen')
names.insert(-2,'Phoebe')
print(names)
L = [95.5, 85, 59, 66, 72]
L.sort(reverse = False)
print('first: ',L[-1])
print('second: ',L[-2])
print('third: ',L[-3])
# Enter a code
L = [95.5, 85, 59, 66, 72]
L.sort(reverse = True)
print('first: ',L[0])
print('second: ',L[1])
print('third: ',L[2])
# Enter a code
courses = ['Chinese', 'Match', 'English']
scores = [92, 75, 99]
oder = [0, 1, 2]
print ('Alice\' score: ')
for i in oder:
print (courses[i],': ',scores[i])
# Enter a code
def list_a(a):
result = 0
for i in a:
result += i*i
return result

L = [10,20]
print list_a(L)
# Enter a code
L = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
S = set([1, 3, 5, 7, 9, 11])
for i in L:
if i in S:
S.remove(i)
else:
S.add(i)
print S
# Enter a code
names = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
name_set = set(names)

a = 'Alice'
for i in name_set:
if a.lower() in i.lower():
print "True"
d = {'Alice': [50, 61, 66, 1], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}
a = 0
for x in d.keys():
a += 1
for y in d[x]:
a += 1

print a
d = {'Alice': [50, 61, 66], 'Bob': [80, 61, 66], 'Candy': [88, 75, 90]}
for x, y in d.items():
for i in y:
print x, i
# Enter a code
d = {
'Alice': 45,
'Bob': 60,
'Candy': 75,
'David': 86,
'Ellena': 49
}
x = 'Alice'
y = 'old_Alice'
if x in d:
d[y] = d[x]
d[x] = 60

print d
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

友情提示:

您好,此课程属于迁移课程,您已购买该课程,无需重复购买,感谢您对慕课网的支持!

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消