gempir

Untitled

Feb 20th, 2020
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. vow = list("aeiouAEIOU")
  2. numbers = list("1234567890")
  3. consonant = list("bcdfghjklmnprstvxzBCDFGHJKLMNPRSTYXZ")
  4. alfanumerice = list('abcdefghijklmnopqrstuvxywzABCDEFGHIJKLMNOPQRSTUVXYWZ0123456789ăîâșțĂÎÂȘȚ,.-')
  5.  
  6.  
  7. def count_characters(input_text):
  8.     characters = len(input_text)
  9.     return characters
  10.  
  11.  
  12. def count_vow(input_text):
  13.     vow_count = 0
  14.     for letter in input_text:
  15.         if letter in vow:
  16.             vow_count += 1
  17.     return vow_count
  18.  
  19.  
  20. def count_consonant(input_text):
  21.     consonant_count = 0
  22.     for letter in input_text:
  23.         if letter in consonant:
  24.             consonant_count += 1
  25.     return consonant_count
  26.  
  27.  
  28. def count_alpha(input_text):
  29.     alpha_count = 0
  30.     for letter in input_text:
  31.         if letter in alfanumerice:
  32.             alpha_count += 1
  33.     return alpha_count
  34.  
  35.  
  36. def count_numbers(input_text):
  37.     numbers_count = 0
  38.     for letter in input_text:
  39.         if letter in numbers:
  40.             numbers_count += 1
  41.     return numbers_count
  42.  
  43.  
  44. def count_words(input_text):
  45.     words = input_text.split()
  46.     return len(words)
  47.  
  48.  
  49. def print_results(input_text):
  50.     print("Total cuvinte in text: " + str(count_words(input_text)))
  51.     print("Total simboluri: " + str(count_characters(input_text)))
  52.     print("In total consoane sunt " + str(count_consonant(input_text)))
  53.     print("In total vocale sunt " + str(count_vow(input_text)))
  54.     print("In total numere sunt " + str(count_numbers(input_text)))
  55.     print("In total alfanumerice sunt " + str(count_alpha(input_text)))
  56.  
  57.  
  58. text = input("Indicati un text: ")
  59. print_results(text)
  60. text1 = input("Text1= ")
  61. print_results(text1)
  62. text2 = input("Text2= ")
  63. print_results(text2)
  64. text3 = input("Text3= ")
  65. print_results(text3)
  66. text4 = input("Text4= ")
  67. print_results(text4)
Advertisement
Add Comment
Please, Sign In to add comment