摘要:
from turtle import * def square(size=50, rgb='gold'): pencolor(rgb) for i in range(4): fd(size) left(90) def main(): setup(800, 600) speed(0) n = 10 f 阅读全文
摘要:
class User(): name='guest' password='111111' def __init__(self,name,password): self.name=name self.password=password self.status=1 def info(self): if 阅读全文
摘要:
def is_valid(x): if len(x[1])==18 and (x[1][:-1].isdigit() and x[1][-1] in '0123456789X'): return True return Falsewith open('data3_id.txt','r',encodi 阅读全文
摘要:
task3: with open('data3.txt','r+', encoding='UTF-8') as f: x = [line.strip('\n') for line in f] x.pop(0) x_print = [eval(i) for i in x] print(f"原始数据:\ 阅读全文
摘要:
task1: print(sum) sum=42 print(sum) def inc(n): sum=n+1 print(sum) return sum sum=inc(7)+inc(7) print(sum) 回答问题:这四处的sum不是一个变量名。 第一个是系统内置函数的‘sum’,作用于数的 阅读全文
摘要:
task1: import random print('用列表存储随机整数:') ls=[random.randint(1,100) for i in range(5)] print(ls) print('\n用集合存储随机整数:') s1={random.randint(1,100) for i 阅读全文
摘要:
task.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 阅读全文
摘要:
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)) 阅读全文