帮我用python语言编程:1.查找元组中以a或A开头并且以c 结尾的所有元素。 tu = ("alec", " Aric", "Alex", "Tony", "rain")
时间: 2023-10-23 12:09:25 浏览: 78
在数组中查找指定元素.cpp
tu = ("alec", "Aric", "Alex", "Tony", "rain")
for element in tu:
if (element.startswith('a') or element.startswith('A')) and element.endswith('c'):
print(element)
阅读全文