摘要: 恢复内容开始 恢复内容开始 from turtle import * def square(size=50, rgb='orange'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4 阅读全文
posted @ 2022-06-12 10:35 刘思彤、 阅读(18) 评论(1) 推荐(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-07 16:14 刘思彤、 阅读(21) 评论(2) 推荐(0) 编辑
摘要: #test-3.py def is_valid(m): if len(m)==18 and m.isdigit(): return 'True' elif len(m)==18 and m[-1]=='X': return 'True' else: return 'False' with open( 阅读全文
posted @ 2022-05-22 09:03 刘思彤、 阅读(29) 评论(2) 推荐(0) 编辑
摘要: #tesk3.py with open('data3.txt','r+', encoding='UTF-8') as f: Z=[] Y=[] x=[] for i in f: x.append(i.strip('\n')) newx=x[1:11] for i in newx: y=float(i 阅读全文
posted @ 2022-05-15 14:40 刘思彤、 阅读(23) 评论(1) 推荐(0) 编辑
摘要: 恢复内容开始 恢复内容开始 恢复内容开始 #test1.py print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 不是一个变量名。 li 阅读全文
posted @ 2022-05-08 11:33 刘思彤、 阅读(41) 评论(1) 推荐(0) 编辑
摘要: #test1.pyimport random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1,10 阅读全文
posted @ 2022-04-22 20:30 刘思彤、 阅读(28) 评论(2) 推荐(0) 编辑
摘要: # 基础操作练习: 列表及列表推导式、格式化、类型转换 x = list(range(10)) print('整数输出1: ', end = '') for i in x: print(i, end=' ') print('\n整数输出2: ', end = '') for i in x: prin 阅读全文
posted @ 2022-04-07 07:40 刘思彤、 阅读(31) 评论(2) 推荐(0) 编辑
摘要: m = input('请输入一个数: ') n = eval(m) y = n**365 print(n,'的365次方:',y) import math m0=float((input('输入鸡蛋质量:'))) t0=float((input('输入鸡蛋原始温度:'))) x=(math.pi) 阅读全文
posted @ 2022-03-25 16:30 刘思彤、 阅读(38) 评论(1) 推荐(0) 编辑
摘要: #print输出的几种用法 #用法一:用于输出单个字符串或单个变量 print('hey', 'u') 阅读全文
posted @ 2022-03-23 16:33 刘思彤、 阅读(29) 评论(0) 推荐(0) 编辑