Skip to content

Instantly share code, notes, and snippets.

@Denkotleta221
Created January 12, 2025 11:55
Show Gist options
  • Save Denkotleta221/9fe57d7e32af2b87a802fc4906cde2f1 to your computer and use it in GitHub Desktop.
Save Denkotleta221/9fe57d7e32af2b87a802fc4906cde2f1 to your computer and use it in GitHub Desktop.
# 1) Task
# text = input("Enter any text: ")
# all_words = text.split()
# length = sum(len(word) for word in all_words)
# count_word = len(all_words)
# midle_length_words = length / count_word if count_word > 0 else 0
# print(f"Midle length words is: {midle_length_words}")
# 2) Task
# text = input("Enter text: ")
# word = input("Enter word: ")
# count = text.lower().split().count(word.lower())
# print(f"Word {word} apeart {count} count in the text")
# 3) Task
# import string, random
# password = int(input("Enter length password: "))
# symbols = string.ascii_letters + string.punctuation + string.digits
# ready_password = ''.join(random.choice(symbols) for i in range(password))
# print(f"Your password: {ready_password}")
# 4) Task
# text = input("Enter text: ")
# letters = [char.lower() for char in text if char.isalpha()]
# letter_count = {}
# for letter in letters:
# if letter in letter_count:
# letter_count[letter] += 1
# else:
# letter_count[letter] = 1
# max_count = 0
# for letter, count in letter_count.items():
# if count > max_count:
# most_common_letter = letter
# max_count = count
# print(f"The most common letter is {most_common_letter}, {max_count} times")
# 5) Task
# email = input("Enter e-mail: ")
# if email.count('@') != 1:
# print("Don't corect mail: ")
# exit()
# name, domian = email.split('@')
# if domian != 'gmail.com':
# print("Don't corect mail: ")
# exit()
# print('Corect e-mail')
# 7) Task
# text = input("Enter words: ")
# if len(text) > 50:
# print("The word should not be more than 50 letters")
# exit()
# lenght = len(text)
# for i in range(1, lenght + 1):
# space = ' ' * (lenght - i)
# print(space + text[:i])
# for i in range(1, lenght):
# space = i * ' '
# print(text[i:] + space)
# 8) Task
# text = input("Enter text: ")
# spam_words = ('boom', 'pig', 'home', 'page')
# words = text.split()
# for word in words:
# if word.lower() in spam_words:
# print("This is SPAM")
# exit()
# print("This is not SPAM")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment