TelenkovDmitry 1 年之前
父节点
当前提交
362140c4be
共有 1 个文件被更改,包括 60 次插入0 次删除
  1. 60 0
      courses/python_for_begginers/func.py

+ 60 - 0
courses/python_for_begginers/func.py

@@ -142,3 +142,63 @@ def get_domain_name(url : str):
 # assert get_domain_name("https://www.mywww.com") == 'mywww'
 # assert get_domain_name("https://www.mywww.com") == 'mywww'
 # print('Проверки пройдены')
 # print('Проверки пройдены')
 
 
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~		
+
+def factorial(n):
+    fact = 1
+    for num in range(2, n + 1):
+        fact *= num
+    return fact
+
+def trailing_zeros(n):
+	s = str(factorial(n))[::-1]
+	l = []
+	for i in range(len(s)):
+		if s[i] != '0':
+			break
+		else:
+			l.append(s[i])
+
+	return len(l)
+
+# assert trailing_zeros(0) == 0
+# assert trailing_zeros(6) == 1
+# assert trailing_zeros(30) == 7
+# assert trailing_zeros(12) == 2 
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~		
+
+def count_AGTC(dna):
+    return dna.count('A'), dna.count('G'), dna.count('T'), dna.count('C')
+
+
+assert count_AGTC('AGGTC') == (1, 2, 1, 1)
+assert count_AGTC('AAAATTT') == (4, 0, 3, 0)
+assert count_AGTC('AGTTTTT') == (1, 1, 5, 0)
+assert count_AGTC('CCT') == (0, 0, 1, 2)     
+print('Проверки пройдены')
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~		
+
+def foo():
+	"Эта функция делает что-то"
+	pass
+
+# print(foo.__doc__)
+
+class Model:
+	"""
+	This is class model
+	"""
+	pass
+
+# help(Model)
+# print(Model.__doc__)
+
+def get_even(lst, number):
+	"""_summary_
+
+	Args:
+		lst (_type_): _description_
+		number (_type_): _description_
+	"""