Python Forum
How to print only vowels from an input?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to print only vowels from an input?
#2
i found the solution
my code:
word = input("Write your word here: ")
print(word)

for letter in word:
	if letter == 'a' or letter == 'e' or letter == 'i' or letter == 'o' or letter == 'u':
		print(letter)
as you can see here i added alot of ors, which basically in human will be like this:
hey python, if the letter variable equals to string a, or the letter variable equals to string b, or the letter variable equals to string i, or the letter variable equals to string o, or the letter variable equals to string u, then print the letter variable
PP9044 likes this post
Reply


Messages In This Thread
How to print only vowels from an input? - by PP9044 - Feb-25-2021, 09:54 PM
RE: How to print only vowels from an input? - by NullAdmin - Feb-25-2021, 10:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Print user input into triangle djtjhokie 1 2,449 Nov-07-2020, 07:01 PM
Last Post: buran
  Counting Vowels in Python sapphosvoice 1 3,360 May-05-2020, 04:24 AM
Last Post: buran
  How to print the docstring(documentation string) of the input function ? Kishore_Bill 1 3,602 Feb-27-2020, 09:22 AM
Last Post: buran
  Print the longest str from user input edwdas 5 4,243 Nov-04-2019, 02:02 PM
Last Post: perfringo
  Return not vowels list erfanakbari1 2 2,743 Mar-26-2019, 11:37 AM
Last Post: perfringo
  Help with finding vowels nlord7 1 2,304 Feb-27-2019, 04:40 AM
Last Post: ichabod801
  Print The Length Of The Longest Run in a User Input List Ashman111 3 3,256 Oct-26-2018, 06:56 PM
Last Post: gruntfutuk
  Help Formatting Print Statement (input from 3 lists) X 2 Hebruiser 11 6,465 Dec-06-2017, 04:47 PM
Last Post: gruntfutuk
  Functions to remove vowels and extra blanks RiceGum 10 5,974 Nov-17-2017, 05:40 PM
Last Post: heiner55
  How to add user input together then print the result Liwuid_Ocelot 6 5,512 Mar-22-2017, 02:18 AM
Last Post: Liwuid_Ocelot

Forum Jump:

User Panel Messages

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