Skip to content

Instantly share code, notes, and snippets.

@savolla
Created August 5, 2017 00:29
Show Gist options
  • Save savolla/ff3bf0d4172982e7e797df835e4088bd to your computer and use it in GitHub Desktop.
Save savolla/ff3bf0d4172982e7e797df835e4088bd to your computer and use it in GitHub Desktop.
Another stupid programm called Text Analyser. It takes the input from the user and gives its vowels, consonants and empty spaces without repetition. Just for learning purposes..
##################################
# Welcome to String analyser 1.0 #
##################################
# ASKING A STRING fROM USER
string = input("enter a string: ")
# VOWEL AND CONSONANT LIST
vowels = "aeıioöuüAEIİOÖUÜ"
consonant = "bcçdfghğjklmnprsştvyzBCÇDFGHĞJKLMNPRSŞTVYZ"
spaces = ""
# RESULT SETS
vow = set()
con = set()
spc = ""
# SOME FUNCTIONS
def draw_lines():
for char in string:
print("-", end = "")
# OPERATION
draw_lines()
print("\n", string, sep = "")
draw_lines()
for char in string:
if char in vowels:
vow.add(char)
elif char in consonant:
con.add(char)
else:
spc = spc + char
if len(vow) != 0:
print("\nvowels are", sorted(vow))
else:
print("your string doesn't contain any vowel")
no_vow = True
if len(con) != 0:
print("consonants are", sorted(con))
else:
print("your string doesn't contain any consonance")
no_con = True
if len(spc) != 0:
print("your string contains {} spaces".format(len(spc)))
elif no_vow and no_con is True:
print("you entered nothing hunny...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment