- 博客(9)
- 收藏
- 关注
原创 python学习----简易版大富翁
import randomimport timeEVENT = ["起点","北京","上海","广州","深圳","向前五步","天津","成都","西安","重庆","向后两步","石家庄","幸运","监狱","沈阳","大连","炸弹","哈尔滨","齐齐哈尔"]CITY = ["北京","上海","广州","深圳","天津","成都","西安","重庆","沈阳","大连","哈尔滨","齐齐哈尔"]def dice(): point = random.randint(1, 6)
2021-01-04 20:17:12
927
3
原创 python学习----登陆
from faker import Fakerfake = Faker(locale='zh_CN') # 伪造中文数据print(fake.ssn())class Person: def __init__(self, zhang_hao, sec_key): self.z_h = zhang_hao self.sk = sec_keyperson_list = []for i in range(0, 1000): zhanghao = fake
2021-01-03 14:39:19
7686
原创 python学习----2048小游戏
#coding:utf-8import randomimport math__mataclass__ = typeclass map2048(): # 设置游戏数据 def reset(self): self.__row = 4 # 行数 self.__col = 4 # 列数 self.data = [ [0 for x in range(self.__col)] for y in
2020-12-22 15:42:32
1640
10
原创 python学习----反恐精英装弹
import timeclass REN: def __init__(self,name): self.name=name self.HP=100 self.PP=0 def install_dan(self,dan,shang): dan.install_shang(shang) def install_qiang(self,dan,qiang): qiang.install_dan_dan(dan)
2020-12-16 20:53:35
383
原创 python学习----全局变量
import randomdef jingling(ball,level,HP): if ball =="大师球": rollcoin=100 return "捕捉到小精灵" elif ball=="高级球": rollcoin=random.randint(70,100) elif ball =="普通球": rollcoin=random.randint(40,90) if level>80:
2020-12-14 19:03:05
120
原创 python学习----简易版小黑屋
import randomimport timeevevt=["衣衫褴褛的人","沼泽"]source=["木材","肉","布"]SKILL=["降龙十八掌","打狗棒法","九阴白骨掌","如来神掌","九阴真经"]def Init(): person={"HP":100,"hungry":100,"IQ":100,"skill":"","木材":100,"fire":0} time.sleep(3) print("人物生成中》》》》》》》》50%") ti
2020-12-10 15:00:36
232
原创 python学习----if函数的应用[(石头,剪刀,布),(判断年份),(判断水仙花)]
str1 = input("请出剪刀,石头,或布:")if str1 =="剪刀": print("我出石头")elif str1 =="石头": print("我出布")elif str1 =="布": print("我出剪刀")else: print("只能输入石头,剪刀,或布")石头剪刀布这个小游戏是运用了if函数进行判断,用户自己输入要出的拳,从而进行游戏的运行,可以去找自己的小伙伴试试,可以一直赢不会输。运行结果:year=int(input ("
2020-12-03 16:00:00
586
原创 python学习----简易版非诚勿扰
该代码使用的是字典和列表和配对,在我自己的写的时候我遇到的困难还是比较多的要注意自己的切片。#encoding:utf-8# 1.sex(性别) 2.city(工作地区) 3.age(年龄)(18-50)#4.heigh(身高)(129-211)5.education(6选1)6.marital_status#7.income(24000-600000)#8.name 姓名 9. aim 对另一半的要求import randomCandidate = []nametext ='''张吉惟、林
2020-12-01 15:08:27
8765
原创 python学习之字符串----简单的维吉尼亚密码
该代码核心思想为采用makeTrans函数随机生成映射表,经过多次映射,相当于一个多表置换密码。写的是较为简单的一种是由英文转换生成密文来进行加密解密。str1 = “abcdefghi,.;:jklmnop!qrstuvwxyz12 346578ABCDEFGHIJKLMNOPQRSTUVWXYZ”str2 = “klmnopqr12s3t,A:5;B.X6DE8!FGH 7IJKL4MNOPQRSTUVWXYZuvwxyzabcdefghij”str3 = “tuvwxy1za2AB3XD7EF
2020-11-26 10:29:52
505
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人