This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#author Duong Tien Hau | |
#Enter a string and the program counts the number of vowels in the text. | |
#For added complexity have it report a sum of each vowel found. | |
def main(): | |
string=input("Enter a string:") | |
countvoyels(string) | |
def countvoyels(string): | |
voyels=dict(a=0,u=0,o=0,i=0,e=0) | |
for k in voyels: | |
voyels[k]=string.count(k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#author Duong Tien Hau | |
#function: Pig Latin is a game of alterations played on the English language game. | |
#To create the Pig Latin form of an English word the initial consonant sound is | |
#transposed to the end of the word and an ay is affixed | |
def main(): | |
string=input("Enter a word:") | |
print(pigLatin(string)) | |
def pigLatin(string): | |
pigstring='' | |
vowels='aeiou' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#author Duong Tien Hau | |
#Function: Enter a string and the program will reverse it and print it out. | |
def reversestring(string): | |
if len(string)==1: return string | |
stringreverce='' | |
for i in range(len(string)): | |
stringreverce+=string[len(string)-(i+1)] | |
return stringreverce | |
def main(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Helloworld") |