Dmitry Telenkov пре 1 година
родитељ
комит
8eb4a77868
2 измењених фајлова са 76 додато и 0 уклоњено
  1. 56 0
      courses/python_for_begginers/enumerate.py
  2. 20 0
      courses/python_for_begginers/set.py

+ 56 - 0
courses/python_for_begginers/enumerate.py

@@ -0,0 +1,56 @@
+a = [10, 20, 30, 40, 50]
+s = 'hello'
+t = ('apple', 'banana', 'mango')
+d = {'a': 1, 'b': 2, 'c': 3}
+
+
+# for index, value in enumerate(a):
+# 	print(index, value)
+
+# for index, value in enumerate(a, 1):
+# 	print(index, value)
+
+
+#  оно же с параметром start
+# for index, value in enumerate(a, 1):
+# 	print(index, value)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
+
+# words = ['feel', 'graduate', 'movie', 'fashionable', 'bacon', 
+#          'drop', 'produce', 'acquisition', 'cheap', 'strength', 
+#          'master', 'perception', 'noise', 'strange', 'am']
+
+# words_with_position = list()
+
+# for index, value in enumerate(words, start=1):
+# 	words_with_position.append((value, index))
+
+# print(words_with_position)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
+
+# english_words = ('attack', 'bless', 'look', 'reckless', 'short', 'monster', 'trolley', 'sound',
+#                  'ambiguity', 'researcher', 'trunk', 'coat', 'quantity', 'question', 'tenant',
+#                  'miner', 'definite', 'kit', 'spectrum', 'satisfied', 'selection', 'carve',
+#                  'ask', 'go', 'suggest')
+
+# for index, value in enumerate(english_words, start=1):
+# 	print(f'Word № {index} = {value}')
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
+
+num = list(input())
+num.reverse()
+
+new_list = [int(value)*2 if index%2 == 0 else int(value) for index, value in enumerate(num, start=1)]
+for i in range(len(new_list)):
+	if new_list[i] > 9:
+		new_list[i] -= 9
+
+if sum(new_list)%10 == 0:
+	print('True')
+else:
+	print('False')
+
+

+ 20 - 0
courses/python_for_begginers/set.py

@@ -163,6 +163,26 @@
 # 		l2.append(i)
 # print(''.join(l2))
 
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
+
+# my_frozen = frozenset()
+# print(my_frozen)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
+
+# l = [int('7'*i) for i in range(1, 78)]
+# my_frozen = frozenset(l)
+# print(my_frozen)
 
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
+
+# l = {int('7'*i) for i in range(1, 78)}
+# print(l)
+
+#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~	
 
+a = frozenset([1, 2])
+b = frozenset([3, 4])
 
+frozen = {a: 1, 'name': b, b: a}
+print(frozen)