摘要: 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) fo 阅读全文
posted @ 2021-06-11 17:20 彭锦荣 阅读(51) 评论(0) 推荐(0)
摘要: class StudentsDoc: def __init__(self, name, number, subject, python): self._name = name self._number = number self._subject = subject self._python = p 阅读全文
posted @ 2021-05-25 17:06 彭锦荣 阅读(62) 评论(1) 推荐(0)
摘要: x = [] f = open('C:\\Users\\J&K\\Desktop\\实验4文档相关代码和数据文件\\实验4文档相关代码和数据文件\\data6_1.txt', encoding='utf_8') y = f.readlines() for i in y: x.append(i.str 阅读全文
posted @ 2021-05-16 14:45 彭锦荣 阅读(55) 评论(0) 推荐(0)
摘要: import random day = random.randint(1, 31) count = 0 print('猜猜2021年5月哪一天是你的lucky day:)') x = int(input(print('你有三次机会, 猜吧(1~31):'))) if count < 3: if x 阅读全文
posted @ 2021-04-16 17:30 彭锦荣 阅读(35) 评论(0) 推荐(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 阅读全文
posted @ 2021-04-16 17:29 彭锦荣 阅读(65) 评论(0) 推荐(0)
摘要: x1, y1 = 1.2, 3.57 x2, y2 = 2.26, 8.7 print('{:-^40}'.format('输出1')) print('x1 = {}, y1 = {}'.format(x1, y1)) print('x2 = {}, y2 = {}'.format(x2, y2)) 阅读全文
posted @ 2021-04-07 21:11 彭锦荣 阅读(32) 评论(0) 推荐(0)
摘要: lists = [] i = 0 n = 1 while i <= 2: x = input('输入愿望') lists.append(x) i += 1 lists.sort() print('{:-^40}'.format('我的愿望清单')) for list in lists: print( 阅读全文
posted @ 2021-04-07 21:07 彭锦荣 阅读(164) 评论(0) 推荐(0)
摘要: lists = '''The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is 阅读全文
posted @ 2021-04-07 20:55 彭锦荣 阅读(404) 评论(0) 推荐(0)
摘要: name_list = ['david bowie', 'louis armstrong', 'leonard cohen', 'bob dylan', 'cocteau twins'] n = 1 name_list.sort() for name in name_list: print(f'{n 阅读全文
posted @ 2021-04-02 17:29 彭锦荣 阅读(56) 评论(0) 推荐(0)
摘要: name_list = ['david bowie', 'louis armstrong', 'leonard cohen', 'bob dylan', 'cocteau twins'] n = 1 for name in name_list: print(f'{n}: {name.title()} 阅读全文
posted @ 2021-04-02 16:52 彭锦荣 阅读(138) 评论(0) 推荐(0)