摘要: class User: count=0 def __init__(self,yonghuming='guest',mima='111111',status=1): User.count+=1 self.yonghuming = yonghuming self.mima = mima self.sta 阅读全文
posted @ 2022-06-08 15:57 bamboosama 阅读(22) 评论(2) 推荐(0) 编辑
摘要: #实验4 from turtle import * def square(size=50, rgb='blue'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800, 600) speed(0) n = 阅读全文
posted @ 2022-06-08 15:54 bamboosama 阅读(25) 评论(1) 推荐(0) 编辑
摘要: #task3.py def is_valid(x): if len(x) != 18: return False else: for i in x: try: i = int(i) except: if ord(i) != ord('X'): return False return True wit 阅读全文
posted @ 2022-05-24 18:11 bamboosama 阅读(11) 评论(4) 推荐(0) 编辑
摘要: #task3.py with open('data3.txt', 'r', encoding='utf-8') as f: data = f.read().strip() a = data.split('\n') y = a.pop(0) b = [] for i in a: x = eval(i) 阅读全文
posted @ 2022-05-17 13:10 bamboosama 阅读(20) 评论(3) 推荐(0) 编辑
摘要: #task1.py print(sum) sum=42 print(sum) def inc(n): sum=n+1 print(sum) return sum sum=inc(7)+inc(7) print(sum) 答:不是。 line1:内置 line3,line11:全局 line7:局部 阅读全文
posted @ 2022-05-10 17:27 bamboosama 阅读(15) 评论(1) 推荐(0) 编辑
摘要: #task1.py import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,1 阅读全文
posted @ 2022-04-26 14:18 bamboosama 阅读(19) 评论(2) 推荐(0) 编辑
摘要: #task1.py 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 阅读全文
posted @ 2022-04-12 22:01 bamboosama 阅读(26) 评论(6) 推荐(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 = {}'.fo 阅读全文
posted @ 2022-03-23 19:37 bamboosama 阅读(69) 评论(7) 推荐(0) 编辑
摘要: https://www.cnblogs.com/bamboosama/ 阅读全文
posted @ 2022-03-23 16:10 bamboosama 阅读(78) 评论(1) 推荐(0) 编辑