Skip to content

Instantly share code, notes, and snippets.

@prodevo
Created January 24, 2025 20:59
Show Gist options
  • Save prodevo/791d33e6409c7ff4920c43471f2e9bd7 to your computer and use it in GitHub Desktop.
Save prodevo/791d33e6409c7ff4920c43471f2e9bd7 to your computer and use it in GitHub Desktop.
ryadky
a = input('vvedit rechennya: ')
total_symbols = 0
total_words = 0
for i in a:
total_symbols += 1
for i in a.split():
total_words += 1
print('serednya dovzhyna slova:', round(total_symbols / total_words, 2), 'symvoliv')
a = input('vvedit rechennya: ')
b = input('vvedit slovo: ')
total_words = 0
for i in a.split():
if i == b:
total_words += 1
print('slovo zustrichaetsya:', total_words , 'raz(y)')
from random import *
digits = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b",
"c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B",
"C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O",
"P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "$", "@",
"&", "?", "+", "-", "*", "/", "%", "=", "!", "№", "_", "^", ",", "."]
a = int(input('vvedit dovzhynu parolya: '))
password = ''
for i in range(a):
password += choice(digits)
print('vash parol:', password)
a = input('vvedit ryadok: ')
for i in range(len(a) + 1):
space = ' ' * (len(a) - i)
symbol = a[:i]
print(space + symbol)
for i in range(1, len(a)):
symbol = a[i:]
print(symbol)
a = input('vvedit ryadok: ').lower()
s= 0
filters = ''
for i in a:
if i.isalnum():
filters += i
for i in range(len(filters)):
if filters[i] == filters[i * (-1) - 1]:
s += 1
if s == len(filters):
print('palindrom')
else:
print('ne palindrom')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment