摘要: 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(10) n=10 for 阅读全文
posted @ 2022-06-14 09:17 一壶花茶 阅读(8) 评论(1) 推荐(0) 编辑
摘要: def main(): pass if __name__ == '__main__': main() def main(): pass if __name__ == '__main__': main() class User: """用户""" count = 0 def __init__(self 阅读全文
posted @ 2022-06-07 22:33 一壶花茶 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 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 open('data 阅读全文
posted @ 2022-05-23 22:55 一壶花茶 阅读(17) 评论(0) 推荐(0) 编辑
摘要: with open('data3.txt','r',encoding='utf-8') as f: data=f.readlines() f.close() with open('data3_proxessed.txt','w',encoding='utf-8') as b: a=['四舍五入后数据 阅读全文
posted @ 2022-05-16 23:47 一壶花茶 阅读(16) 评论(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) 内置,全局,局部,全局 task2.2 list1 = [1, 9, 8 阅读全文
posted @ 2022-05-11 13:07 一壶花茶 阅读(16) 评论(1) 推荐(0) 编辑
摘要: task1 import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,100) 阅读全文
posted @ 2022-04-26 21:05 一壶花茶 阅读(27) 评论(1) 推荐(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 = '- 阅读全文
posted @ 2022-04-12 21:24 一壶花茶 阅读(19) 评论(2) 推荐(0) 编辑
摘要: task1_1 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 阅读全文
posted @ 2022-03-29 10:23 一壶花茶 阅读(18) 评论(2) 推荐(0) 编辑