标签:inf int nbsp += alt ... pytho com col
#-*-coding:utf-8-*- ‘‘‘ 计算 1-2+3-4+5...+99 ‘‘‘ sum = 0 for i in range(1,100): if i%2 ==0: sum = sum - i else: sum +=i print(sum)
#-*-coding:utf-8-*- ‘‘‘ 计算 1-2+3-4+5...+99 ‘‘‘ i = 1 sum = 0 while i<100: if i%2 ==0: sum = sum - i else: sum +=i i= i+1 print(sum)
Python(50)_for循环与while循环实现1-2+3...+99
标签:inf int nbsp += alt ... pytho com col
原文地址:https://www.cnblogs.com/sunnybowen/p/10230956.html