随笔分类 - 零基础开始学Python
摘要:import wx class MyFrame(wx.Frame): def __init__(self, parent, id): super(MyFrame, self).__init__(parent, id, title='用户登录', size=(400, 300)) panel = wx
阅读全文
摘要:import jieba with open('./西游记.txt', 'r', encoding='utf_8') as f: words = jieba.lcut(f.read()) # 使用精确模式对文本进行分词 counts = {} # 通过键值对的形式存储词语及其出现的次数 for wo
阅读全文
摘要:from random import random def printInfo(): ''' function: 打印程序的介绍信息 ''' print("产品名称: 排球比赛模拟分析器") print("产品概述: 通过输入2个队伍A和B的能力值(0到1之间的小数表示),能够模拟多次2个队伍A和B
阅读全文
摘要:七段数码管绘制系统时间(年,月,日,小时) 代码 import datetime # 引入时间库 import random import turtle # 引入海龟库 def drawLine(draw): # 绘制单段数码管 turtle.pendown() if draw else turtl
阅读全文
摘要:from collections import namedtuple City=namedtuple('City','name country population coordinates') '''创建一个具名元组需要两个参数,一个是类名,另一个是类的各个字段的名字。 后者可以是由数个字符串组成的
阅读全文
摘要:第二周作业 计算矩形面积 if __name__ == '__main__': x = eval(input('请输入矩形的长:')) y = eval(input('请输入矩形的宽')) print('矩形的面积为:{:.2f}'.format(x * y)) 格式化输出 import math
阅读全文
摘要:从零开始学Python 第一节课 学会了Python的变量赋值、运算符使用和强制类型转换 if __name__ == '__main__': print('Hello World') print('人因梦想而伟大') print('▁▄▇▇▄▁') print('人是唯一会交易的动物,因为没有狗会
阅读全文
摘要:使用Python的print函数来输出植物大战僵尸中的石头怪 根据给出的图片用字符串来拼接植物大战僵尸中的石头怪 print(' ' * 2 + '* ' * 5 + '\n' + ' ' + '*' + ' ' * 10 + '*' + '\n' \ + '*' + ' ' * 4 + '@' +
阅读全文

浙公网安备 33010602011771号