摘要:
from turtle import * def square(size=50, rgb='pink'): '''绘制正方形 参数size指定边长 参数rgb指定画笔颜色 如果没有给参数,采用默认值 ''' pencolor(rgb) for i in range(4): fd(size) left 阅读全文
摘要:
task3 def is_valid(x): if len(x) != 18: return False for i in x: if not (i.isdigit() or i == 'X'): return False else: return True import csv l=[] with 阅读全文
摘要:
实验三 with open('data3.txt', 'r+', encoding = 'utf-8') as f,open('data3_processed.txt', 'r+', encoding = 'utf-8') as ff: num=[line.strip('\n') for line 阅读全文
摘要:
print(sum) sum = 42 print(sum) def inc(n): sum = n + 1 print(sum) return sum sum = inc(7) + inc(7) print(sum) question:task1.py源码中,共有4处有python语句print( 阅读全文
摘要:
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 阅读全文
摘要:
x=list(range(10)) print('整数输出1:',end='') for i in x: print(f'{i:02d}', end = '-') print('\n整数输出2:',end='') for i in x: print(f'{1:02d}',end='-') print 阅读全文