Python Forum
Return not vowels list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Return not vowels list
#2
In your current code:
Your first outer loop (line 10-13, second code block) writes out 'Sorry' for every uppercase vowel in your string (it ignores 'a' but catches 'A')

Your second outer loop (line 15-19) adds a letter to the list multiple times. The reason for this is the loop on line 16 which makes you examine every letter many times. Try to replace this with an 'if' statement instead testing if your character is in the vowels set or not.

In your last code block you have an error. You can use the 'in' operator with two strings to check if the first string is in the other. However, 'vowels' is not a string, you can check its type with
print(type(vowels))
.

Hope this helps you a step closer.
Reply


Messages In This Thread
Return not vowels list - by erfanakbari1 - Mar-26-2019, 08:48 AM
RE: Return not vowels list - by Pereskia - Mar-26-2019, 10:13 AM
RE: Return not vowels list - by perfringo - Mar-26-2019, 11:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to sort a list with duplicates and return their unique indices. Echoroom 3 3,614 Sep-23-2022, 07:53 AM
Last Post: deanhystad
Bug How to print only vowels from an input? PP9044 8 7,699 Feb-26-2021, 04:02 PM
Last Post: Serafim
  Return the sum of the first n numbers in the list. pav1983 3 4,203 Jun-24-2020, 03:37 AM
Last Post: deanhystad
  Counting Vowels in Python sapphosvoice 1 3,357 May-05-2020, 04:24 AM
Last Post: buran
  Methods that return the highest score from the list erfanakbari1 7 7,271 Mar-26-2019, 08:32 PM
Last Post: aankrose
  Help with finding vowels nlord7 1 2,303 Feb-27-2019, 04:40 AM
Last Post: ichabod801
  Functions to remove vowels and extra blanks RiceGum 10 5,968 Nov-17-2017, 05:40 PM
Last Post: heiner55
  Calling a function to return a list of percentages Liquid_Ocelot 7 6,376 Mar-25-2017, 01:20 PM
Last Post: Larz60+
  maximum and minimum element from the list and return output in dict MeeranRizvi 1 3,783 Jan-02-2017, 02:12 PM
Last Post: ichabod801
  Print the index of the vowels in a string MeeranRizvi 4 14,777 Dec-29-2016, 02:43 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020