摘要: #task3 from turtle import * def square(size=50,rgb='orange'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800,600) speed(0) n 阅读全文
posted @ 2022-06-14 00:36 孙艺欣 阅读(29) 评论(2) 推荐(0) 编辑
摘要: class User: def __init__(self,name='guest',password=111111,status=1): self.name=name self.password=password self.status=status def info(self): print(' 阅读全文
posted @ 2022-06-08 13:16 孙艺欣 阅读(31) 评论(3) 推荐(0) 编辑
摘要: #task3 def is_valid(x): if len(x)==18: if x.isdigit() or( x[:-1].isdigit() and x[-1]=='X'): return True else: return False else: return False with ope 阅读全文
posted @ 2022-05-23 21:43 孙艺欣 阅读(29) 评论(2) 推荐(0) 编辑
摘要: #task3 with open('data3.txt','r',encoding='utf-8')as f1: with open('data3_processed.txt','w',encoding='utf-8')as f2: a=f1.read().split('\n') a.pop(0) 阅读全文
posted @ 2022-05-16 23:54 孙艺欣 阅读(35) 评论(2) 推荐(0) 编辑
摘要: #task1 print(sum) sum=42 print(sum) def inc(n): sum=n+1 print(sum) return sum sum=inc(7)+inc(7) print(sum) 不是 1.内置作用域 2.全局作用域 3.局部作用域 4.全局作用域 #task2_1 阅读全文
posted @ 2022-05-10 15:09 孙艺欣 阅读(34) 评论(2) 推荐(0) 编辑
摘要: #task1 import random print('用列表储存随机整数:') ls=[random.randint(1,100) for i in range(5)] print(ls) print('\n用集合储存随机整数:') s1={random.randint(1,100) for i 阅读全文
posted @ 2022-04-26 23:24 孙艺欣 阅读(36) 评论(3) 推荐(0) 编辑
摘要: #task1 x=list(range(10)) print('整数输出1:',end='') for i in x: print(i,end='') print('\n整数输出2:',end='') for i in x: print(f'{i:02d}',end='-') print('\n整数 阅读全文
posted @ 2022-04-12 21:10 孙艺欣 阅读(33) 评论(3) 推荐(0) 编辑
摘要: #task1_1.py print('hey,u') print('hey','u'') x,y,z=1,2,3 print(x,y,z) print('x=%d,y=%d,z=%d'%(x,y,z)) print('x={},y={},z={}'.format(x,y,z)) print(f'x= 阅读全文
posted @ 2022-03-30 00:15 孙艺欣 阅读(37) 评论(4) 推荐(0) 编辑