num = 0 sum = 0 while True: if num > 1000: break if num % 2 == 0: sum = sum + num num = num + 1 print(sum)
整除,%为取余数,就是除下来以后余多少