实验八 python库应用编程与体验

摘要: task--3 from turtle import * def square(size=50,rgb='pink'): rgb = 'yellow' pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800,6 阅读全文
posted @ 2022-06-13 21:58 haze13327620097 阅读(21) 评论(2) 推荐(0) 编辑

实验7 类和模块

摘要: task5 name源码 ''' 数据:用户名,密码''' class User: '''用户名密码输出,修改密码,重置密码,封禁解封账户''' def __init__(self,name = 'guest',password = 111111,status = '1'): self._name 阅读全文
posted @ 2022-06-05 17:35 haze13327620097 阅读(19) 评论(2) 推荐(0) 编辑

实验六 文件应用编辑-2

摘要: Task——3 def is_valid(x): if len(x) != 18 : return False else: for i in x: if '0'<=i<='9'or i=='X': continue return False else: return True import csv 阅读全文
posted @ 2022-05-23 22:55 haze13327620097 阅读(21) 评论(2) 推荐(0) 编辑

实验五 文件应用编辑

摘要: task3 with open('data3.txt','r',encoding='utf-8') as f : with open('data3_processed.txt', 'w', encoding='utf-8') as f1: data=f.read().strip().split('\ 阅读全文
posted @ 2022-05-17 11:42 haze13327620097 阅读(25) 评论(3) 推荐(0) 编辑

实验4 函数与异常处理应用编辑

摘要: Task 1 print(sum) sum = 42 print(sum) def inc(n): sum = n+1 print(sum) return sum sum = inc(7) + inc(7) print(sum) 不是 1.sum函数未创建,内建函数作用域中不能改变 2.sum被赋予 阅读全文
posted @ 2022-05-09 23:47 haze13327620097 阅读(27) 评论(4) 推荐(0) 编辑

实验3 控制语句与组合数据类型应用编辑

摘要: #task——1import random print('用列表存储随机整数:') ls = [random.randint(1,100) for i in range(5)] print(ls) print('\n用集合存储随机整数:') s1 = {random.randint(1,100) f 阅读全文
posted @ 2022-04-25 15:43 haze13327620097 阅读(30) 评论(5) 推荐(0) 编辑

实验2 字符串和列表

摘要: 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('\ 阅读全文
posted @ 2022-04-11 21:54 haze13327620097 阅读(25) 评论(5) 推荐(0) 编辑

实验1 Python开发环境使用和编程初体验

摘要: #print输出的几种用法 #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 = {}'. 阅读全文
posted @ 2022-03-27 00:45 haze13327620097 阅读(33) 评论(5) 推荐(0) 编辑