diff --git a/1.py b/1.py new file mode 100644 index 0000000..cbc0882 --- /dev/null +++ b/1.py @@ -0,0 +1,13 @@ +a=["张三","李四","张三","李四","李四"] +for i in a: + if i=='李四': + a.remove("李四") +print(a) +# i=0 +# while i<len(a): +# print(len(a)) +# if a[i]=='李四': +# a.remove("李四") +# i=i-1 +# i=i+1 +# print(a) \ No newline at end of file diff --git a/10.py b/10.py new file mode 100644 index 0000000..28479a8 --- /dev/null +++ b/10.py @@ -0,0 +1,16 @@ +import turtle +turtle.penup() +turtle.goto(-100,100) +turtle.pendown() +for i in range(4): + turtle.forward(200) + turtle.right(90) +turtle.penup() +turtle.home() +turtle.dot(20,"red") +turtle.goto(-40,0) +turtle.dot(20,"red") +turtle.goto(40,0) +turtle.dot(20,"red") +turtle.hideturtle() +turtle.done() \ No newline at end of file diff --git a/11.py b/11.py new file mode 100644 index 0000000..576d858 --- /dev/null +++ b/11.py @@ -0,0 +1,18 @@ +import turtle +turtle.penup() +turtle.goto(-90,90) +turtle.pendown() +turtle.color("black","red") +turtle.begin_fill() +for i in range(4): + turtle.forward(180) + turtle.right(90) +turtle.end_fill() +turtle.color("black","yellow") +turtle.begin_fill() +turtle.goto(90,90) +turtle.goto(-90,-90) +turtle.goto(-90,90) +turtle.end_fill() +turtle.hideturtle() +turtle.done() \ No newline at end of file diff --git a/12.py b/12.py new file mode 100644 index 0000000..99fee59 --- /dev/null +++ b/12.py @@ -0,0 +1,2 @@ +a=input() +print("百",a[0],"十",a[1],"",a[2]) \ No newline at end of file diff --git a/2.py b/2.py new file mode 100644 index 0000000..152a71a --- /dev/null +++ b/2.py @@ -0,0 +1,41 @@ +# a=(3,42,2,3,4,65,7,8,6) +# b=sorted(a) +# # print(b) +# print(-5 and not 0) +# # print(1 or 0) +# print(4/2) +# print(4.0//2) +# #增加 + +# a.append(10) +# print(a) +# a.insert(2,5) +# print(a) +# print(a[2:5]) +# a.extend(a[2:5]) +# print(a) +# # #删除 +# a.pop(3) +# # print(a) +# # del a[4] +# # print(a) +# # a.remove(3) +# # a[0]=20 +# # a.clear() +# # print(a) +# sum=0 +# for i in a: +# if i==4: +# sum+=1 +# print(sum) +# while 3 in a: +# a.remove(3) +# print(a) +a=[2,3,4,23,2,3,4,5] +# b=a[:] +# a.sort() +# print(a) +# print(b) +# for i in range(1,len(a),2): +# print(a[i]) +print(a[1::2]) \ No newline at end of file diff --git a/3.py b/3.py new file mode 100644 index 0000000..20a2782 --- /dev/null +++ b/3.py @@ -0,0 +1,17 @@ +""" +dlkfskld +dsfsdf +sdfsdfsd +sdfds +fsdf + +# """ +# print("我%010.1f岁了!"%13.88) +print('sfsddsf'+r'\n'+'kdsjfkldjslkfj'+r'\n'+'sdfsdfsdf') +# a='13' +# int(a) +# print(type(a)) +a=input("name:") +b=input("age:") +c=input("grade:") +print('我的姓名:{},年龄:{}岁,年级:{}年级'.format(a,b,c)) \ No newline at end of file diff --git a/4.py b/4.py new file mode 100644 index 0000000..ce7de6c --- /dev/null +++ b/4.py @@ -0,0 +1,7 @@ +# ls =["2021","123","Python"] +# ls.append([2021,"2021"]) +# ls.append(2021) +# print(ls) +a=list("fiveadfad") +a[2:]=list("ddf") +print(a) \ No newline at end of file diff --git a/5.py b/5.py new file mode 100644 index 0000000..098167a --- /dev/null +++ b/5.py @@ -0,0 +1,16 @@ +import turtle +turtle.penup() +turtle.goto(-100,100) +turtle.pendown() +for i in range(4): + turtle.forward(200) + turtle.right(90) +turtle.color("black","blue") +turtle.penup() +turtle.goto(-50,0) +turtle.pendown() +turtle.left(90) +turtle.begin_fill() +turtle.circle(-50,-360) +turtle.end_fill() +turtle.done() \ No newline at end of file diff --git a/6.py b/6.py new file mode 100644 index 0000000..3d355dc --- /dev/null +++ b/6.py @@ -0,0 +1,7 @@ +a={'1':"————星期一",'2':"————星期二"} +while True: + b=input("输入数字:") + try: + print(b,a[b]) + except: + print("输入错误!") diff --git a/7.py b/7.py new file mode 100644 index 0000000..ac9cc77 --- /dev/null +++ b/7.py @@ -0,0 +1,27 @@ +# a={1:3,4:5} +# print(a.popitem()) +# # print(a) +# # str='www.baidu.com.34.54' +# # print(str.find("4")) +# # print(str.split('.',3)) +# # print("{0},{2}".format(4,5,4)) +# a=[99,80,86,89,94,92,75,87,86,95] +# zd=max(a) +# zx=min(a) +# print(zd,zx) +# a.remove(zd) +# a.remove(zx) +# print(a) +# average=sum(a)/len(a) +# # print(average) +# a=input("Python:") +# b=a.count("python") +# print(b) +a=int(input("begin:")) +b=int(input("end:")) +for i in range(a,b+1): + for j in range(2,i): + if i%j==0: + break + else: + print(i,"是质数") \ No newline at end of file diff --git a/8.py b/8.py new file mode 100644 index 0000000..16d586e --- /dev/null +++ b/8.py @@ -0,0 +1,9 @@ +a=input() +b=[] +for i in a: + if i>='0' and i<='9': + continue + else: + b.append(i) +c="".join(b) +print(c) \ No newline at end of file diff --git a/9.py b/9.py new file mode 100644 index 0000000..c5dd2c6 --- /dev/null +++ b/9.py @@ -0,0 +1,28 @@ +# import turtle +# turtle.color("blue") +# turtle.begin_fill() +# turtle.circle(100) +# turtle.end_fill() +# # turtle.done() +# a=int(input("sfdsd:")) +# b=int(input("sdfsd:")) +# print("长方形的面积是:",a*b,sep="") +# print("长方形的周长是:",(a+b)*2,sep="") +import turtle +def draw(x,y,ys): + turtle.penup() + turtle.goto(x,y) + turtle.pendown() + turtle.color("black",ys) + turtle.begin_fill() + for i in range(4): + turtle.forward(100) + turtle.right(90) + turtle.end_fill() +draw(-100,100,"black") +draw(0,0,"black") +draw(0,100,"white") +draw(-100,0,"white") +turtle.hideturtle() +turtle.done() +