创建一个列表,其中包含你喜欢的水果,再编写一系列独立的治语句,检查列表中是否包含特定的水果。 将该列表命名为favorite_fruits,并在其中包含三种水果。 編写5条许吾句,每条都检查某种水果是否包含在列表中,如果包含在列表中,就打印一条消,息,如You really rike bananas.o 输出 You really like blueberries! You really like peaches!
时间: 2024-02-20 20:01:00 浏览: 168
好的,以下是Python代码实现:
```
favorite_fruits = ['banana', 'blueberry', 'peach']
if 'banana' in favorite_fruits:
print('You really like bananas!')
if 'blueberry' in favorite_fruits:
print('You really like blueberries!')
if 'peach' in favorite_fruits:
print('You really like peaches!')
if 'apple' in favorite_fruits:
print('You really like apples!')
if 'orange' in favorite_fruits:
print('You really like oranges!')
```
输出结果为:
```
You really like bananas!
You really like blueberries!
You really like peaches!
```
阅读全文