-2

for example: for a letter in a word, if the letter is preceded by a vowel..................

how would you write that in pythonic language

for example: if a "h" is preceded by a "s" anywhere in a word, return(True)

the_word("bash")
True

the_word("sushi")
True
Nick Stephen
  • 55
  • 1
  • 5

1 Answers1

0
a = 'h'
b = 's'

if b+a in "bash": # True
  ..
if b+a in "hello": # False
  ..
if b+a in "sushi": # True

If you want this in a function, just have a and b as parameters

Tim
  • 41,901
  • 18
  • 127
  • 145