摘要: PIL库的概述: PIL库可以完成图像归档和图像处理两方面功能需求: 图像归档:对图像进行批处理、生成图像预览、图像格式转换等; 图像处理:图像基本处理、像素处理、颜色处理等。 PIL库Image类: from PIL import Image m = Image.open("D:\\picture 阅读全文
posted @ 2020-04-14 00:39 Jessie- 阅读(1408) 评论(0) 推荐(0) 编辑
摘要: 一元二次方程求根 一元二次方程ax2+bx+c=0,a、b、c的值由用户在三行中输入,根据用户输入的数值求解方程的实数解:‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪ 阅读全文
posted @ 2020-04-11 00:28 Jessie- 阅读(2250) 评论(0) 推荐(0) 编辑
摘要: 水仙花数 水仙花数(Narcissistic number)也被称为超完全数字不变数(pluperfect digital invariant, PPDI)、自恋数、自幂数、阿姆斯壮数或阿姆斯特朗数(Armstrong number),水仙花数是指一个 n位数(n≥3 且 n<6),它的每个位上的数 阅读全文
posted @ 2020-04-08 19:13 Jessie- 阅读(66) 评论(0) 推荐(0) 编辑
摘要: 运用jieba库统计词频,并对词频进行排序 import jieba txt = open("文章.txt","r",encoding='gbk',errors='replace').read() words = jieba.lcut(txt) counts = {} for word in wor 阅读全文
posted @ 2020-04-07 00:27 Jessie- 阅读(441) 评论(0) 推荐(0) 编辑
摘要: 青蛙跳台阶计算 一只青蛙一次可以跳上1级台阶,也可以跳上2级。请问该青蛙跳上一个n级的台阶总共有多少种跳法。‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬ 阅读全文
posted @ 2020-04-06 22:08 Jessie- 阅读(1948) 评论(0) 推荐(1) 编辑
摘要: 分类统计字符 用户输入一个字符串,分别统计其中小写字母、大写字母、数字、空格和其他字符的个数,并在一行内输出小写字母、大写字母、数字、空格和其他字符的个数。 n=input() small=big=num=space=other=0 for i in n: if(ord(i)>=ord("a") a 阅读全文
posted @ 2020-04-01 16:13 Jessie- 阅读(2212) 评论(0) 推荐(0) 编辑
摘要: 实现和线上汉诺塔移动问题 def hannuo(n,a,b,c): if n == 1: print(a,"->",c) else: hannuo(n-1,a,c,b)#将最后一个盘子移到c print(a,"->",c)#将剩余的盘子移动c hannuo(n-1,b,a,c) n = int(in 阅读全文
posted @ 2020-03-30 22:36 Jessie- 阅读(390) 评论(0) 推荐(1) 编辑
摘要: 用Python计算圆周率pi并用进度条提示进度 一 计算公式: 二 实现代码 (1) import math from tqdm import tqdm import time total,s,n,t=0.0,1,1.0,1.0 while(math.fabs(t)>=1e-6): total+=t 阅读全文
posted @ 2020-03-24 22:34 Jessie- 阅读(541) 评论(0) 推荐(0) 编辑
摘要: 凯撒密码 恺撒密码是古罗马凯撒大帝用来对军事情报进行加解密的算法,它采用了替换方法对信息中的每一个英文字符循环替换为字母表序列中该字符后面的第三个字符,即,字母表的对应关系如下:‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‪‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‭ 阅读全文
posted @ 2020-03-20 16:10 Jessie- 阅读(1644) 评论(0) 推荐(0) 编辑
摘要: 数列求和 给定某数字 a(1≤a≤9)以及非负整数n(0≤n≤100000),求数列之和sum=a+aa+aaa+⋯+aa⋯a(n个a)。 例如a=2, n=3时,sum=2+22+222=246。 a=int(input()) b=int(input()) n=0 sum=0 for i in r 阅读全文
posted @ 2020-03-18 18:00 Jessie- 阅读(3519) 评论(2) 推荐(0) 编辑