stay hungry stay foolish

python(条件与循环)

if语句

a=99
if(a>90):
	print('优秀')
else:
    print('一般')

a=100
if(a>99):
	print('优秀')
elif(a>80):
    print('良')
else:
	print('一般')

循环

循环有两种:for…in,while

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