为了账号安全,请及时绑定邮箱和手机立即绑定
def greet(name="world"):
if name == "world":
print("Hello, world.")
else:
print(f"Hello, {name}.")
# Enter a code
a=5
x=a
d=10
z=d/5
c=28
t=c/7
y=(x*z)/t
print(y,z)
def greet(L='world'):
sc='Hello,{}'.format(L)
return sc
print(greet())
print(greet('Lisi')
def square_of_sum(list):
result = 0
for num in list:
result += num * num
return result

print(square_of_sum([1, 2, 3, 4, 5]))
# Enter a code
L = [[1, 2, 3], [5, 3, 2], [7, 3, 2]]

for i in range(len(L)):
a = L[i][0]
b = L[i][1]
c = L[i][2]
print(2 * (a*b + b*c + a*c))
# Enter a code
names = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
new1 = 'Zero'
new2 = 'Phoebe'
new3 = 'Gen'

names.append(new2)
names.append(new1)
names.insert(5, new3)

print(names)
# Enter a code

s1='ABC'
s2='123'
s3='xyz'

for i in s1:
for j in s2:
for k in s3:
print(i + j + k)
# Enter a code

i = 0
sum = 0

while i <= 1000:
if i%2 != 0:
i = i+1
continue
sum += i
i = i+1

print (sum)
# Enter a code

i = 0
sum = 0

while True:
if i > 1000:
print (sum)
break
if i%2 == 0:
sum += i
i = i+1
浮点数
字符串
整数
二进制数
在3.12.3版本,输入0.2+0.3的结果就是0.5,与这课上说的不同
ndn
num = 1
sum = 1
while num <=10:
sum*= num
num+= 1
print(num)
print(sum)
a = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
b = a.append('Gen') and a.append('Phoebe') and a.append('Zero')
print(a)
a = ['Alice', 'Bob', 'Candy', 'David', 'Ellena']
b = a.append('Gen')
c = a.append('Phoebe')
d = a.append('Zero')
print(a)
L = [95.5, 85, 59, 66, 72]
L = sorted(L)
p = (L[-1])
pr = (L[-2])
pri = (L[-3])
print('第一名: {}'.format(p))
print('第二名: {}'.format(pr))
print('第三名: {}'.format(pri))
首页上一页1234567下一页尾页
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

意见反馈 帮助中心 APP下载
官方微信
友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消