文章目录
1.
python
import turtle
# 颜色
turtle.pencolor("red")
# 线条粗细
turtle.pensize(6)
#面向方向移动 180
turtle.forward(180)
#逆时针旋转 120
turtle.left(120)
turtle.forward(80)
turtle.left(60)
turtle.forward(100)
turtle.left(60)
turtle.forward(80)
turtle.done()
2.
python
num=1
count=0
while num<=100:
# 开始循环
sum=0
for n in range(1,num+1):
sum += n
# print("sum=",sum," count=",count)
count += sum;
# print(count)
num +=1
print(count)
3.
python
num=1
count=0
while num<=10:
# 开始循环
sum=0
for n in range(1,num+1):
sum += n
# print("sum=",sum," count=",count)
count += sum;
# print(count)
num +=1
print(count)
4.
python
# -*- coding:utf-8 -*-
num = input("请输入数字 : ")
num =int(num)
if num % 400 == 0 or (num % 4 ==0 and num % 100 != 0):
print("Yes")
else:
print("No")
5.
python
for i in range(1,10):
for j in range(1,i+1):
print(i,"*",j, "=",i*j,end='\t')
print()
6.
python
num1=0
num2=1
index=3
print(0)
print(1)
while index <=20:
# 开始循环
newNum=num1+num2;
num1=num2;
num2=newNum
print(newNum)
index += 1