为了账号安全,请及时绑定邮箱和手机立即绑定
L = [75, 92, 59, 68, 99]
sum =0

for i in L:
sum=i+sum
avg=sum/5
print(avg)
age = 5

if age>=18:
print('adult')
elif age<18 and age>=6:
print('teenager')
elif age<6 and age>=3:
print('kid')
else:
print('baby')
# Enter a code
age=12
if age>=18:
print("adult")
else:
print('teenager')
# Enter a code
age = 19
if age>=18:
print("adult:{}".format(age))
else:
print('weichengnian ')
s='AABCDEFGHHIJ'

s2=s[-11:-4]
print(s2)
# Enter a code
s='AABCDEFGHHIJ'
s1=s[1:9]
print(s1)
lis='Life {i}, you {n}'
lo1='is short'
lo2='need Python'
lls=lis.format(i=lo1,n=lo2)
print(lls)
lis='Life {1}, you {0}'
lo=lis.format('need Python','is short')
print(lo)

最新回答 / 阿肥肥
\t是制表符,一般在输出的时候为了好看才会用到,主要是在C语言的dos界面输出内容时会用到,Python我还没用过
a='python'
print('hello,',a or 'world')

b=''
print('hello,',b or 'world')
# b为False,b or 'world'输出‘world’
longs=3.14
wide=1.57
area=longs*wide
result=round(area,2)

print('长方形面积是:%s',result)
# Enter a code
a='h'
a1='e'
a2='ll'
a3='o'
b='Wo'
b1='rld'
# print(a+a1+a2+a3,b+b1)

c=(a+a1+a2+a3,b+b1)

print(c)

最新回答 / SunTv
代码没有区别,只是输出结果上有区别。python2 如果是10/3的话,会输出3,而python3的话,会输出3.33333··5,结果更加科学。
num=list()
x=1
while x<101:
num.append(x*x)
x=x+1
print(x)
print(sum(num))
s1 = set([1, 2, 3, 4, 5])
s2 = set([1, 2, 3, 4, 5, 6, 7, 8, 9])
if s1.isdisjoint(s2)==False:
for x in s1:
if x in s2:
print(x)
课程须知
如果您了解程序设计的基本概念,会简单使用命令行,了解中学数学函数的概念,那么对课程学习会有很大的帮助,让您学起来得心应手,快速进入Python世界。
老师告诉你能学到什么?
通过本课程的学习,您将学会搭建基本的Python开发环境,以函数为基础编写完整的Python代码,熟练掌握Python的基本数据类型以及list和dict的操作,灵活使用流程控制语句。

微信扫码,参与3人拼团

微信客服

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

帮助反馈 APP下载

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

公众号

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

友情提示:

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

本次提问将花费2个积分

你的积分不足,无法发表

为什么扣积分?

本次提问将花费2个积分

继续发表请点击 "确定"

为什么扣积分?

举报

0/150
提交
取消