Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isVowel(l):
- if l == "a" or l == "A" or l == "e" or l == "E" or l == "i" or l == "I" or l == "o" or l == "O" or l == "u" or l == "U":
- return True
- else:
- return False
- inStr = input("Enter Name: ")
- inStrE = inStr.split(" ")
- inStrDictVow = {}
- inStrDictCons = {}
- vowels = []
- consonants = []
- for l in inStr:
- if l == " ":
- continue
- if isVowel(l):
- if l in inStrDictVow.keys():
- inStrDictVow[l] += 1
- else:
- inStrDictVow.update({l:1})
- else:
- if l in inStrDictCons.keys():
- inStrDictCons[l] += 1
- else:
- inStrDictCons.update({l:1})
- for v in inStrDictVow.keys():
- vowels.append(v)
- for c in inStrDictCons.keys():
- consonants.append(c)
- print("Name: %s" % inStr)
- print("Vowels: %s" % vowels)
- print("Consonants: %s" % consonants)
- cnt = -1
- Vows = {}
- for y in inStr:
- cnt += 1
- if isVowel(y):
- if y in Vows.keys():
- continue
- Vows.update({y:cnt})
- x = ""
- z = ""
- print("Vowels: %s:%s" % (y,Vows[y]), end=", ")
- try:
- x = inStr[cnt*2]
- z = cnt*2
- except:
- print("No Consonant associated")
- break
- print("Consonant: %s:%s" % (x,z))
- print("Indexception Total: %i" % (int(len(inStr)) + 1))
- #Marc Reinhard Canlas Ballon
Advertisement
Add Comment
Please, Sign In to add comment