Hamge

学习记录

导航

随笔分类 -  Demo

字符加密
摘要:# coding=utf-8 import random import hashlib import rsa from Cryptodome.Cipher import DES import binascii from Cryptodome.Cipher import AES from Cryptodome import Random def encryption(type,str): ... 阅读全文

posted @ 2019-08-02 10:53 Hamge 阅读(351) 评论(0) 推荐(0)

Python 汉诺塔
摘要:在汉诺塔游戏中,有三个分别命名为A、B、C得塔座,几个大小各不相同,从小到大一次编号得圆盘,每个原盘中间有一个小孔。最初,所有得圆盘都在A塔座上,其中最大得圆盘在最下面,然后是第二大,以此类推. 游戏的目的是将所有的圆盘从塔座A移动到塔座B;塔座C用来防止临时圆盘,游戏的规则如下: 1、一次只能移动 阅读全文

posted @ 2019-04-26 10:53 Hamge 阅读(602) 评论(0) 推荐(0)

Python 找零问题
摘要:#coding = utf-8 def Change_Money(money): print('总金额:'+str(money)+'元') loop=True tmp=[] # 面值列表 单位:元 type = [100,50,20,10,5,1,0.5,0.1] sy = int(money*10) #将传入的金额*10,转换为... 阅读全文

posted @ 2019-04-25 15:26 Hamge 阅读(772) 评论(0) 推荐(0)

Python 二分法
摘要:# coding = utf-8 import random def Creat_Arr(): arr = [] for i in range(0,50) : arr.append(random.randint(1,100)) i += 1 arr.sort() #排序 return arr def Select_Key(... 阅读全文

posted @ 2019-04-24 10:58 Hamge 阅读(213) 评论(0) 推荐(0)

Python 冒泡排序
摘要:# coding = utf-8 import random def Creat_Arr(): arr = [] for i in range(0,10) : arr.append(random.randint(1,100)) i += 1 print ('生成数组 : %s'%arr) return arr def Arr... 阅读全文

posted @ 2019-04-24 10:11 Hamge 阅读(145) 评论(0) 推荐(0)

Python 简单模拟斗地主发牌
摘要:#coding = utf-8 import random def Creat_Card(): card_type = ['♥','♠','♦','♣'] card_values= ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K'] n=1 ca 阅读全文

posted @ 2019-04-23 17:51 Hamge 阅读(1837) 评论(1) 推荐(0)