摘要: from turtle import * def square(size=50, rgb='gold'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) left 阅读全文
posted @ 2022-06-14 07:50 戎梓瑞 阅读(4) 评论(3) 推荐(0) 编辑
摘要: class User(): def __init__(self,name="guest",password='111111',status=1): self._name=name self._password=password self._status=status def define(self) 阅读全文
posted @ 2022-06-05 09:10 戎梓瑞 阅读(6) 评论(2) 推荐(0) 编辑
摘要: import csv list3=[] #shenfenzhenghao list1=[] #xingming list2 = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'X'] with open('data3_id.txt', 'r', 阅读全文
posted @ 2022-05-21 14:02 戎梓瑞 阅读(2) 评论(1) 推荐(0) 编辑
摘要: with open('data3.txt', 'r', encoding='utf-8') as f: data = f.read().split('\n') yuanshishuju = data.pop(0) data1 = [eval(i) for i in data] data2 = [ro 阅读全文
posted @ 2022-05-14 10:40 戎梓瑞 阅读(18) 评论(2) 推荐(0) 编辑
摘要: 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.给sum赋予一个值 3.局部变量 3.全局变量 2. list1 阅读全文
posted @ 2022-05-04 18:28 戎梓瑞 阅读(22) 评论(1) 推荐(0) 编辑
摘要: 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-20 18:56 戎梓瑞 阅读(15) 评论(2) 推荐(0) 编辑
摘要: 任务一 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-06 21:50 戎梓瑞 阅读(16) 评论(2) 推荐(0) 编辑
摘要: print('hey,u') print('hey','hey') 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={x},y={y},z 阅读全文
posted @ 2022-03-26 11:04 戎梓瑞 阅读(39) 评论(2) 推荐(0) 编辑