Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #Write a function called has_a_vowel. has_a_vowel should have
  2. #one parameter, a string. It should return True if the string
  3. #has any vowels in it, False if it does not.
  4.  
  5.  
  6. def has_a_vowel(a_str):
  7. print("Starting...")
  8. for letter in a_str:
  9. print("Checking", letter)
  10. if letter in "aeiou":
  11. print(letter, "is a vowel, returning True")
  12. return True
  13. else:
  14. print(letter, "is not a vowel, returning False")
  15. continue
  16. print("Done!")
  17.  
  18.  
  19. #Below are some lines of code that will test your function.
  20. #You can change the value of the variable(s) to test your
  21. #function with different inputs.
  22. #
  23. #If your function works correctly, this will originally
  24. #print: True, then True, then False, then False, each on
  25. #its own line.
  26. print(has_a_vowel("abba"))
  27. print(has_a_vowel("beeswax"))
  28. print(has_a_vowel("syzygy"))
  29. print(has_a_vowel(""))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement