python练习

sum = 0
for x in range(0,100,2):
	sum = sum + x
print("100以内偶数和:%s"%sum)

 

 

sum = 0 
for x in range(1,100,2):
	sum = sum + x
print("100以内奇数和:%s"%sum)

 

 

#打印等腰三角形
for i in range(6):
	for j in range(0,5-i):	#打印空格
		print(' ',end ='')	#''中按空格键
	for k in range(0,2*i+1):	#打印*号
		print('*',end ='')
	print()

 python练习_第1张图片

 

你可能感兴趣的:(python)