Created
August 5, 2017 00:29
-
-
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..
This file contains 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
################################## | |
# 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