Demonstrates creating new strings with a for loop : String Declaration « String « Python






Demonstrates creating new strings with a for loop

 

message = raw_input("Enter a message: ")
new_message = ""
VOWELS = "aeiou"

print
for letter in message:
    if letter.lower() not in VOWELS:
        new_message += letter
        print "A new string has been created:", new_message

print "\nYour message without vowels is:", new_message

   
  








Related examples in the same category

1.String can be expressed in several ways: enclosed in single quotes or double quotesString can be expressed in several ways: enclosed in single quotes or double quotes
2.String literals span multiple lines in several ways.String literals span multiple lines in several ways.