We can use .startswith to find a word is the F word or not. The code as follow:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
''' @Author: Jedi.XL @Email: xiangyangan@gmail.com @Created Time: 6:22:24 PM, Oct 23, 2019 @Github: https://github.com/jediL @Website:www.tundrazone.com ------------ 苔原带 ------------ ''' def is_or_not(value): if value.lower().startswith(("f")): return "is" else: return "not" print(is_or_not("Funk")) # is |