已采纳回答 / qq_慕哥7109103
for x in s:的意思就是挑出set([])里的每一个元素,每一次循环就是输出一个('A',95),对于('A',95)来说x[0]就是‘A’,x[1]就是95
2020-05-08
sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
elif x % 2 == 0:
continue
sum += x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
elif x % 2 == 0:
continue
sum += x
print sum
2020-05-08
最新回答 / weixin_慕哥0152991
方法一:print [n*100+m*10+n for n in range(1,10) for m in range(0,10)]方法二:L1=[0,1,2,3,4,5,6,7,8,9]print [n*100+m*10+n for n in L1[1:] for m in L1]方法三:print [int(a+b+a) for a in '123456789' for b in '0123456789']
2020-05-07
思考题
age = 8
if age >= 18:
print 'adult'
elif age>6:
print 'teenage'
else:
print 'kid'
age = 8
if age >= 18:
print 'adult'
elif age>6:
print 'teenage'
else:
print 'kid'
2020-05-07
最新回答 / kuo先生
print L[a:b:c]对L进行切片,从下标索引为a的元素开始,到下标索引为b的元素为止(b不包含),每隔c个取一次第一个参数省略表示从下标0位置开始,第二个参数省略表示到最后一个元素为止
2020-05-07
# 十六进制数据必须加上括号才行
print(45678+(0x12fd2))
print('Learn Python in imooc')
print(100<99)
print((0xff)==255)
print(45678+(0x12fd2))
print('Learn Python in imooc')
print(100<99)
print((0xff)==255)
2020-05-06