摘要: 一、凯撒密码:替换方法对信息中的每一个英文字符循环替换为字母表序列该字符后面的第三个字符,特殊符号不进行加密处理 对于原文中的字符P,其密文字符C满足如下条件: 凯撒密码的加密方法:C=(P+3)mod 26 凯撒密码的解密方法:P=(C-3)mod 26 加密第一种方法: plaincode = 阅读全文
posted @ 2020-04-16 11:31 可乐配牛奶 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-04-08 09:04 可乐配牛奶 阅读(79) 评论(0) 推荐(0) 编辑
摘要: from wordcloud import WordCloud import matplotlib.pyplot as plt import jieba # 生成词云 def create_word_cloud(filename): with open('hongloumong.txt',encod 阅读全文
posted @ 2020-04-05 22:14 可乐配牛奶 阅读(405) 评论(0) 推荐(0) 编辑
摘要: 一、python字符串替换可以用两种方法实现: 1.用字符串本身的方法 2.用正则来替换字符串 下面用个例子来实验: a = 'hello word' 我把a字符串里的word替换为python 1.用字符串本身的replace方法 a.replace('word' , 'python') 输出结果 阅读全文
posted @ 2020-04-05 10:54 可乐配牛奶 阅读(29497) 评论(0) 推荐(1) 编辑
摘要: 一、用动画实现汉诺塔问题: import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self 阅读全文
posted @ 2020-03-28 16:17 可乐配牛奶 阅读(672) 评论(0) 推荐(0) 编辑
摘要: 圆周率的计算 计算公式:pi / 4=1 - 1/3 + 1/5 - 1/7 + 1/9 ...... 梅钦公式:pi /4 = 4arctan1/5 - arctan1/239 n=圆周长/直径 n=圆面积/半径平方 import math import time scale=10 print(" 阅读全文
posted @ 2020-03-21 14:14 可乐配牛奶 阅读(439) 评论(0) 推荐(0) 编辑
摘要: import turtle as t t.pensize(3) t.pencolor("blue") t.penup() t.fd(-250) t.seth(0) t.pendown() t.fillcolor("yellow") t.begin_fill() n=10 for i in range 阅读全文
posted @ 2020-03-15 15:51 可乐配牛奶 阅读(1082) 评论(0) 推荐(0) 编辑
摘要: import turtle n = 60 # 每行间隔,小格子边长 x = -300 # x初始值 y = -300 # x初始值 def main(): turtle.speed(11) turtle.pensize(2) turtle.penup() # 先画8*8的正方形,并按要求涂黑 for 阅读全文
posted @ 2020-03-15 15:23 可乐配牛奶 阅读(782) 评论(0) 推荐(0) 编辑
摘要: from turtle import * pensize(3) penup() pencolor("black") reset() speed(10) pendown() circle(100,180) circle(200,180) circle(100,-180) fillcolor('blac 阅读全文
posted @ 2020-03-15 14:56 可乐配牛奶 阅读(1834) 评论(0) 推荐(0) 编辑
摘要: import turtle as t t.setup(600,600,50,50) t.pensize(3) t.pencolor("red") t.penup() t.pendown() t.circle(45) t.penup() t.fd(100) t.seth(0) t.pendown() 阅读全文
posted @ 2020-03-15 14:32 可乐配牛奶 阅读(590) 评论(0) 推荐(0) 编辑