学习python之余与大家分享一下,大佬勿喷,当然大佬们有兴趣斧正的话,在下也非常高兴。

说一下思路:

根据年龄段定义了数个元组,将每个年龄段可能发生的事情进行归类放置,并引用随机数模块random在规定年龄段随机抽取事件,废话不多说,直接上代码:

td1=("随身玉佩","红肚兜","动漫高手","天赋异禀","天生抑郁","网络巨魔","天龙人","独生子女","乡间微风","城中高楼","美籍华人","家中老大","水性良好","先天免疫","人类进化","超凡","父母美貌","红颜薄命","属蛇","半神","人中龙凤","阴阳之外","彩虹之下","斩情证道","桃花连连","平安童年","宠物大师","天生残疾","早产儿","十死无生","家运不顺","头着地","胎教","班中红人","骑士","永远的神","戒律","丁克","少数民族","老司机","低压","战功","不孕不育","白头偕老","神秘的小盒子","三十而立","四十不惑","知天命","耳顺","从心所欲","老当益壮","鹤发童颜","学前启蒙","十八变","迟来之财","理财达人","理财达人","成熟","形象管理","成年礼","开光之胎","天命","祖传药丸","精准扶贫","乐天派","命悬一线","智可生财","舔狗甚多","保胎丸","白化病","佛宗","悟道")
td3=("你出生了,是个男孩儿","你出生了,是个女孩儿") td4=("你从小生活在农村","你从小生活在城市","你从小生活在美国")
td5=("你开始看动漫","你父母并没有精心照顾你","你的父母对你视若珍宝,呵护备至","家人到城里务工,你在农村留守","你第一次坐在躺椅上,看灿烂的银河星空","你的大姐出嫁,收了很多彩礼","你喜欢用父母的手机玩王者荣耀","你喜欢用父母的手机刷抖音","你和村里小孩打架","你喜欢去周围的小池塘边玩","你喜欢去周围的小池塘边玩","你偷了父母的零钱去买零食","家人到城里务工","你的生活很自由,没有什么束缚","有一只鸟撞在了你家窗户上","你意外挖到一个上了锁的盒子","你发现你和其他人的想法好像都不一样","你被一只蛇咬了","你常常坐在家门口发呆,十分无聊")
td6=("下暴雨,发洪水,田都被淹了","大旱灾,颗粒无收","有天打雷,劈断了你家门口一棵树")
td7=("你的绘画天赋好像不错","你当上了班长","你当上了领操员","你为班级出了一次黑板报","你和同桌偷偷谈起了恋爱","你们的数学老师是一个支教老师","你在学校交到了新朋友","平平淡淡,没有什么特别的事","你的数学天赋好像不错","你的音乐天赋好像不错","你的绘画天赋好像不错","你的脸意外被开水烫伤","你的母亲因病去世","你的父亲在种地时意外发现一箱金条、家境有所好转")
td2=(td3,td4,td5,td6,td7) qsxx1=int(input("你的年龄是:"))
print("转世重修中.......................................................................................................................................................................")
if qsxx1<18: import random xh1=random.randint(0,70) xh2=random.randint(0,70)
xh3=random.randint(0,70) xh4=random.randint(0,70) xh5=random.randint(0,70)
print("您的天赋是:",td1[xh1],td1[xh2],td1[xh3],td1[xh4],td1[xh5]) elif qsxx1>=18 and
qsxx1<100: import random xh1=random.randint(0,70) xh2=random.randint(0,70)
xh3=random.randint(0,70) print("您的天赋是:",td1[xh1],td1[xh2],td1[xh3]) else:
import random xh1=random.randint(0,70) xh2=random.randint(0,70)
print("您的天赋是:",td1[xh1],td1[xh2]) #初始属性总数50,0为最低,10为正常,100为古往今来人类所能达到的最高水平
print("请为【智慧】【美貌】【力量】【身体素质】【家境】【气运】六项属性加点,起始点:50")
a=int(input("请选择为【智慧】加点(直接填写数字0~50)")) print("剩余点数",(50-a)) if a<=50:
b=int(input("请选择为【美貌】加点(直接填写数字)")) print("剩余点数",(50-a-b)) if (a+b)<=50:
c=int(input("请选择为【力量】加点(直接填写数字)")) print("剩余点数",(50-a-b-c)) if (a+b+c)<=50:
d=int(input("请选择为【身体素质】加点(直接填写数字)")) print("剩余点数",(50-a-b-c-d)) if
(a+b+c+d)<=50: e=int(input("请选择为【家境】加点(直接填写数字)"))
print("剩余点数",(50-a-b-c-d-e),"已全部加到【气运】中") f=50-a-b-c-d-e else: a=8 b=8 c=8 d=8
e=8 f=8 else: a=8 b=8 c=8 d=8 e=8 f=8 else: a=8 b=8 c=8 d=8 e=8 f=8 else: a=8
b=8 c=8 d=8 e=8 f=8 print("【智慧】【美貌】【力量】【身体素质】【家境】【气运】分别为:",a,b,c,d,e,f)
print("......................................................................................................................................................准备已就绪")
sta=input("是否重开人生(是/否)") if sta=="是": print("人生已开启") elif sta=="否":
print("您已开启鬼生") else: print("人间和地府已经容不下你了,要不,您去玉帝那看看?") n=0 import random
dsxl1=random.randint(0,len(td3)-1) dsxl2=random.randint(0,len(td4)-1)
dsxl3=random.randint(0,len(td5)-1) dsxl4=random.randint(0,len(td6)-1)
dsxl5=random.randint(0,len(td7)-1) life=str(td3[dsxl1]) while life!="你死了":
import random dsxl1=random.randint(0,len(td3)-1)
dsxl2=random.randint(0,len(td4)-1) dsxl3=random.randint(0,len(td5)-1)
dsxl4=random.randint(0,len(td6)-1) dsxl5=random.randint(0,len(td7)-1)
print(n,"岁:",life) n=n+1 if n<=7: life=str(td5[dsxl3]) elif n==8: life="你上小学了"
elif n>8 and n<14: life=str(td7[dsxl5]) elif n==14: life="你获得了一项特别强大的超能力" else:
life="你因为自大而败给了邪恶势力,你死了" break import time time.sleep(1) print(n,"岁:",life)
import time time.sleep(10)

技术
今日推荐
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:766591547
关注微信