好的,我们可以使用 Python 的随机模块来实现这个程序。
首先,我们需要先安装 Python 的图像处理库 Pillow:
pipinstall Pillow
然后,我们可以使用以下代码来实现这个程序:
import random
from PIL import Image
def decide_meal():
meals = ['博留', '民勇', '外卖']
meal = random.choice(meals)
if meal == '博留':
img = Image.open('boliu.jpg')
elif meal == '民勇':
img = Image.open('minyong.jpg')
elif meal == '外卖':
img = Image.open('takeout.jpg')
else:
raise ValueError('Invalid meal')
img.show()
print(f'今天吃{meal}')
decide_meal()
这段代码会随机选择一个选项,并输出对应的食物照片。