print(1+2+3+4)

# python的循环有两种，一种是for x in...循环，依次把list或者tuple里面的元素迭代出来，比如

names=('Sam','Max','Leo')
for name in names:
print(name)

# 我们试一下计算1-10整数之和，可以用sum变量做累加

sum = 0
for x in (1,2,3,4,5,6,7,8,9,10):
sum =sum + x
print(sum)

# 在python中有一个'range'的函数，可以生成一个整数序列，再通过'list'函数转为list

print(list(range(100)))

# 第二循环是while循环，只要条件满足，就可以不断循环，否则退出循环，比如计算100以内的奇数和

sum = 0
n = 99

while n > 0:
sum = sum +n
n = n - 2
print(sum)

sum = 0
n = 99
while n > 0:
break
sum = sum +n
n = n - 2
print(sum,'break 跳出当前循环')

sum = 2
n = 99
s = 100
while n > 0:

# continue 跳出本轮循环，不执行本轮循环的后面操作，直接进入下一轮循环。

```            ```
sum = sum +n
n = n - 2
continue
s = 0
```
```

print('%d %d %d'%(sum,s,n))

n = 0
sum = 0
res = 0
while (n <=50):
res = (res+ n )
n = n + 1
print(res)
n=60
while (n<=100):
sum = (sum + n)
n = n + 1
sum=sum+res
print(sum)

# 方法二： 先计算0-100的整数和，在减去50-60的整数和。

n = 0
sum =0
res = 0
while n<=100:
sum = (sum +n)
n = n + 1
print(sum)
print(n)
n = 51
while n >50 and n <60:
res = (res + n)
n = n + 1
print(res)
print(sum - res)

# 方法三：通过if语句判断50-60的整数，使用continue跳出当前循环，在继续执行

n=0
sum=0
res=0
while n<=100:
if n <= 50:
res=(res + n)
n=n+1
elif (n>50 and n<60) :
n=n+1
continue
else :
sum=sum+n
n=n+1
print(res)
print(sum+res)

**