Day2:故事随机生成

How to build a random story generator using python?有一次卷福去吉米秀,俩人根据卷福随机想到的几个单词,大开脑洞,编了一个小品。👇下面是金句赏析“The crime scene has your butt written all over it.”"You know one of the best parts about being a detective, is that I get to lock up criminals like yo
摘要由CSDN通过智能技术生成

How to build a random story generator using python?

有一次卷福去吉米秀,俩人根据卷福随机想到的几个单词,大开脑洞,编了一个小品。

👇下面是金句赏析

“The crime scene has your butt written all over it.”

"You know one of the best parts about being a detective, is that I get to lock up criminals like you and go home to my children and my pet badger, and say this town needs an enema."

效果直接拉满。

这次尝试的story generator是让自己辅助我们完成这个工作。代码如下。

Generator 1:

import random
#list of books is stored in the list -'books'
books = ['Mother','Midnight Children','My experiments with truth']

#An item from the list 'books' is selected
#by random.choice()
print(random.choice(books))

Generator 2:

#Importing random module
import random

#Defining list of phrases which will help to build a story
Sentence_starte
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值