最赞回答 / _____然
if 判断语句 可解释为如果x % 2 取余数 例如 5 % 2 等于 1x / 2 取商 例如 5 / 2 等于 2一般判断是否为奇偶数用x % 2因为偶数除以2不会有余数 奇数除以2总会余1
2019-08-05
已采纳回答 / 慕名而来lj
<...code...>while True: if n > 20: break这里就是取前20项的和,到第21项就退出 sum = sum + x这里就是每一项相加求和了 x = x * 2根据题意1,2,4,8,16.....都是二倍关系,因此赋值x = x * 2 n = n + 1这里就是从第一项到第二十项了
2019-08-04
最新回答 / weixin_慕码人9112255
s = 'Python was started in 1989 by "Guido".\nPython is free and easy to learn.'ORs = '''Python was started in 1989 by "Guido".Python is free and easy to learn.'''
2019-08-04