摘要: from turtle import* setup(800,600) speed(0) pencolor('pink') n=10 for i in range(n): for j in range(2): circle(80,90) left(90) right(360/n) hideturtle 阅读全文
posted @ 2022-06-13 23:55 wfffww 阅读(1) 评论(0) 推荐(0) 编辑
摘要: class User: def __init__(self,name='guest',password=111111,status=1): self.name=name self.password=password self.status=status def info(self): print(' 阅读全文
posted @ 2022-06-07 11:31 wfffww 阅读(5) 评论(1) 推荐(0) 编辑
摘要: def is_valid(x): ls=[str(i) for i in range(0,10)] ls.append('X') if len(x)<18: return False for a in range(len(x)): if x[a] not in ls: return False br 阅读全文
posted @ 2022-05-25 12:09 wfffww 阅读(6) 评论(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-16 23:45 wfffww 阅读(5) 评论(1) 推荐(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) 不是同一个变量名 line1:内置函数名 line3:赋值名 line 阅读全文
posted @ 2022-05-11 12:24 wfffww 阅读(10) 评论(3) 推荐(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 in rang 阅读全文
posted @ 2022-04-25 08:40 wfffww 阅读(14) 评论(3) 推荐(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='-') print('\n整数输出3:',en 阅读全文
posted @ 2022-04-11 08:34 wfffww 阅读(18) 评论(3) 推荐(0) 编辑
摘要: # print输出的几种用法 # 用法1:用于输出单个字符串或单个变量 print('hey, u') # 用法2: 用于输出多个数据项,用逗号分隔 print('hey', ' u') x,y,z = 1,2,3 print(x, y, z) # 用法3: 用户混合字符串和变量值 print('x 阅读全文
posted @ 2022-03-24 10:59 wfffww 阅读(14) 评论(3) 推荐(0) 编辑
摘要: print(''hi,python,I'm trying'') a,b=eval(input('Enter two numbers: ')) print(f'a = {a},b={b}') 阅读全文
posted @ 2022-03-23 23:03 wfffww 阅读(9) 评论(0) 推荐(0) 编辑