1、下列输出是什么
(1)
print(6 or 2 > 1)
6
(2)
print(0 or 5 > 4)
5
(3)
print(5 < 4 or 3)
3
(4)
print( 2 > 1 or 6 )
True
(5)
print(3 > 1 and 0 )
0
(6)
print( 0 and 3 > 1 )
0
2、计算1-2+3.....+99中除了88以外所有数总和
num = 1
sum = 0
while num < 100:
if num == 88:
num += 1
continue
else:
if num % 2 == 0:
sum = sum - num
else:
sum = sum + num
num += 1
print(sum)
138
3、计算1-2+3.....+98-99中除了88以外所有数总和
num = 0
j = -1
sum = 0
while num < 100:
num += 1
if num == 88:
continue
else:
j = -j
sum = sum + num * j
print(sum)
50