摘要: task3.py 1 from turtle import * 2 3 def square(size=50, rgb='orange'): 4 pencolor(rgb) 5 for i in range(4): 6 fd(size) 7 left(90) 8 9 10 def main(): 1 阅读全文
posted @ 2022-06-13 21:18 虞渊 阅读(10) 评论(2) 推荐(0) 编辑
摘要: 1 class User: 2 def __init__(self,name='guest',password=111111,status=1): 3 self.name=name 4 self.password=password 5 self.status=status 6 def info(se 阅读全文
posted @ 2022-06-06 23:07 虞渊 阅读(13) 评论(2) 推荐(0) 编辑
摘要: task3.py 1 def is_valid(y): 2 if len(y)==18: 3 y1=y[:17] 4 if y1.isdigit(): 5 for j in y: 6 y2=[] 7 y2.append(j) 8 m=['1','2','3','4','5','6','7','8', 阅读全文
posted @ 2022-05-24 13:42 虞渊 阅读(13) 评论(2) 推荐(0) 编辑
摘要: task3.py 1 with open('data3.txt','r+', encoding='UTF-8') as f: 2 Z=[] 3 Y=[] 4 x=[] 5 for i in f: 6 x.append(i.strip('\n')) 7 newx=x[1:11] 8 for i in 阅读全文
posted @ 2022-05-16 21:45 虞渊 阅读(15) 评论(3) 推荐(0) 编辑
摘要: task1.py 1 print(sum) 2 sum = 42 3 print(sum) 4 def inc(n): 5 sum = n+1 6 print(sum) 7 return sum 8 sum = inc(7) + inc(7) 9 print(sum) 1.Built-in 2.Gl 阅读全文
posted @ 2022-05-09 23:56 虞渊 阅读(11) 评论(2) 推荐(0) 编辑
摘要: task1.py 1 import random 2 3 print('用列表存储随机整数: ') 4 ls = [random.randint(1, 100) for i in range(5)] 5 print(ls) 6 7 print('\n用集合存储随机整数: ') 8 s1 = {ran 阅读全文
posted @ 2022-04-25 21:44 虞渊 阅读(17) 评论(3) 推荐(0) 编辑
摘要: task1.py 1 x = list(range(10)) 2 print('整数输出1: ', end = '') 3 for i in x: 4 print(i, end=' ') 5 6 print('\n整数输出2: ', end = '') 7 for i in x: 8 print(f 阅读全文
posted @ 2022-04-12 22:02 虞渊 阅读(12) 评论(3) 推荐(0) 编辑
摘要: 实验任务1 task1-1.py 1 print('hey, u') 2 3 print('hey', ' u') 4 x,y,z = 1,2,3 5 print(x, y, z) 6 7 print('x = %d, y = %d, z = %d' %(x,y,z)) 8 print('x = { 阅读全文
posted @ 2022-03-28 22:54 虞渊 阅读(19) 评论(4) 推荐(0) 编辑