21.将列表["to”,"take”,”the”,”time”,"to”,"smell”,"the”,"roses”]和列表["花花”,”时间”,”时间”,”闻闻”,”身边的”,“玫瑰”]连接,相邻两个单词之间插入指定字符*,注意:相关逗号、引号等的中英文输入法保持一致
时间: 2024-05-08 22:15:18 浏览: 37
代码如下:
```python
list1 = ["to", "take", "the", "time", "to", "smell", "the", "roses"]
list2 = ["花花", "时间", "时间", "闻闻", "身边的", "玫瑰"]
result = []
for i in range(len(list1)):
result.append(list1[i])
result.append("*")
result.append(list2[i])
result.pop() # 删除最后一个多余的星号
print(result)
```
输出结果为:
```
['to', '*', '花花', 'take', '*', '时间', 'the', '*', '时间', 'time', '*', '闻闻', 'to', '*', '身边的', 'smell', '*', '玫瑰', 'the']
```
相关问题
将列表["to”,"take”,”the”,”time”,"to”,"smell”,"the”,"roses”]和列表["花花”,”时间”,”时间”,”闻闻”,”身边的”,“玫瑰”]连接,相邻两个单词之间插入指定字符*,注意:相关逗号、引号等的中英文输入法保持一致。pythob
代码如下:
```python
list1 = ["to", "take", "the", "time", "to", "smell", "the", "roses"]
list2 = ["花花", "时间", "时间", "闻闻", "身边的", "玫瑰"]
result = []
for i in range(len(list1)):
result.append(list1[i])
result.append("*")
result.append(list2[i])
# 去掉最后一个多余的*
result.pop()
print(result)
```
输出结果为:
```
['to', '*', '花花', 'take', '*', '时间', 'the', '*', '时间', 'time', '*', '闻闻', 'to', '*', '身边的', 'smell', '*', '玫瑰', 'the']
```
英语补语例句 动词+sb+to do sth或者 动词+sb+doing sth
1. I heard him singing in the shower. (heard为动词,him为sb,singing为补语)
2. I saw her leave the house. (saw为动词,her为sb,leave为补语)
3. The teacher found the students sleeping in class. (found为动词,the students为sb,sleeping为补语)
4. They made me wait for an hour. (made为动词,me为sb,wait为补语)
5. She caught her son stealing cookies from the jar. (caught为动词,her son为sb,stealing为补语)
6. He felt his heart pounding with excitement. (felt为动词,his heart为sb,pounding为补语)
7. I noticed the child crying in the corner. (noticed为动词,the child为sb,crying为补语)
8. The smell of fresh bread made my mouth water. (made为动词,my mouth为sb,water为补语)
9. She heard the birds chirping outside the window. (heard为动词,the birds为sb,chirping为补语)
10. He felt the ground shaking beneath his feet. (felt为动词,the ground为sb,shaking为补语)