Skip to content

Instantly share code, notes, and snippets.

@duonghau
duonghau / Countvoyels.py
Created July 31, 2015 04:42
countvoyels
#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)
@duonghau
duonghau / Pig Latin.py
Created July 31, 2015 03:47
Pig latin
#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'
@duonghau
duonghau / reservestring.py
Created July 31, 2015 03:32
reversestring
#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():
@duonghau
duonghau / hello.py
Created July 31, 2015 02:59
First file
print("Helloworld")