1st=[] #定义一个空列表,用于存放水仙花数
: #用for循环遍历所有的三位数
a= #个位
b= (i//10) %10 #十位
c= #百位
if
1st. append (i) #在列表的末尾追加一个元素
print(lst) #输出列表
for i in range(5) :
print(i)
学习了Python编程之后,老师留给了同学们一个作业—编写程序计算“1+2+3+…+100”的结果并输出。
height=input('你的身高是多少米:')
height=float(height)
weight =input('你的体重是多少KG:')
weight =float(weight)
BMI=weight/(height*height)
if BMI>=24.9:
print('肥胖')
① BMI<24.9 ② BMI>=18.5:
print('正常')
else:
print('偏瘦')
>>> print("hello","Python World!")
>>> print("hello","Python World!",sep='')
>>> print("hello","Python World!",sep=' ')
>>> print("hello","Python World!",sep=',')