TelenkovDmitry 5 mēneši atpakaļ
vecāks
revīzija
2ad24f77c7
1 mainītis faili ar 23 papildinājumiem un 1 dzēšanām
  1. 23 1
      courses/python_func/func_1.py

+ 23 - 1
courses/python_func/func_1.py

@@ -99,6 +99,26 @@ def get_leap_years(y1, y2):
     return leap_years
 
 
+# Создание палиндрома
+def create_palindrome(value):
+    if is_palindrome(value):
+        return value.lower()
+    ret = ''
+    ret = value + '_i_' + value[::-1]
+    return ret.lower()
+
+
+# Сравнение строк
+def is_strings_equal(st1, st2):
+    return sorted(st1) == sorted(st2)
+
+
+#
+def is_dunder(st):
+    return st.startswith('__') and st.endswith('__') and \
+    len(st) >= 6 and st[2:-2].isalpha()
+
+
 def main():
     # print_histogram([1, 2, 3])
     # print(test_1('hello'))
@@ -106,7 +126,9 @@ def main():
     # print(is_palindrome("Never Odd or Even"))
     # print(is_palindrome("qwerty"))
     # print(count_leap_years(2021, 2021))
-    print(get_leap_years(1990, 2021))
+    # print(get_leap_years(1990, 2021))
+    # print(is_strings_equal('afdsa', 'aasdfa'))
+