写一段有趣的python代码
时间: 2023-04-10 07:01:36 浏览: 131
当然,我可以回答这个问题!以下是一段有趣的 Python 代码,可以生成一个随机的笑话:
```python
import random
jokes = [
"Why did the tomato turn red? Because it saw the salad dressing!",
"Why did the chicken cross the playground? To get to the other slide!",
"Why did the cookie go to the doctor? Because it was feeling crumbly!",
"Why did the banana go to the doctor? Because it wasn't peeling well!",
"Why did the coffee file a police report? It got mugged!",
]
print(random.choice(jokes))
```
每次运行这个程序,它都会随机选择一个笑话并输出。希望你喜欢!
阅读全文