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(0) n = 10 Read More
posted @ 2022-06-09 19:14 青桔水溶C Views(4) Comments(2) Diggs(0) Edit
class User: def __init__(self, name='guest', password=111111, status=1): self.name = name self.password = password self.status = status def info(self) Read More
posted @ 2022-06-05 20:22 青桔水溶C Views(5) Comments(1) Diggs(0) Edit
def is_valid(x): if len(x)!=18: return False else: if x.isdecimal(): return True elif x.find('X')and x.strip('X').isdecimal(): return True else: retur Read More
posted @ 2022-05-22 19:15 青桔水溶C Views(2) Comments(1) Diggs(0) Edit
with open('data1_1.txt', 'r', encoding = 'utf-8') as f: data = f.readlines() n = 0 for line in data: if line.strip('\n') == '': continue n += 1 print( Read More
posted @ 2022-05-17 15:54 青桔水溶C Views(6) Comments(3) Diggs(0) Edit
1. print(sum) sum=42 print(sum) def inc(n): sum=n+1 print(sum) return sum sum=inc(7)+inc(7) print(sum) 不是 line1作用域为line1 line2作用域为line2 line7作用域为line6 Read More
posted @ 2022-05-10 16:04 青桔水溶C Views(5) Comments(0) Diggs(0) Edit
import random print('用列表存储随机整数: ') ls = [random.randint(1, 100) for i in range(5)] print(ls) print('\n用集合存储随机整数: ') s1 = {random.randint(1, 100) for i Read More
posted @ 2022-04-23 23:25 青桔水溶C Views(10) Comments(2) Diggs(0) Edit
1. 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: Read More
posted @ 2022-04-12 17:55 青桔水溶C Views(7) Comments(1) Diggs(0) Edit
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(x,y,z)) Read More
posted @ 2022-03-27 01:11 青桔水溶C Views(22) Comments(3) Diggs(0) Edit