diff --git a/Task 1/YTypucT/YTypucT.py b/Task 1/YTypucT/YTypucT.py new file mode 100644 index 0000000..d777969 --- /dev/null +++ b/Task 1/YTypucT/YTypucT.py @@ -0,0 +1,6 @@ +# single-string comment + +''' +multi-string comment +:) +''' \ No newline at end of file diff --git a/Task 10/YTypucT/YTypucT.py b/Task 10/YTypucT/YTypucT.py new file mode 100644 index 0000000..09efab2 --- /dev/null +++ b/Task 10/YTypucT/YTypucT.py @@ -0,0 +1,14 @@ +num_1 = 13 +str_1 = "it's a string" +list_1 = ["it's a string in the list"] +dict_1 = { + num_1 : 666, + "it's a key" : str_1, + num_1 + 50 : num_1, + str_1[0] : list_1, + str_1 : list_1[0], + 69 : 69 +} +num_2 = dict_1[num_1] +print(num_2) +print(dict_1) \ No newline at end of file diff --git a/Task 11/YTypucT/YTypuct.py b/Task 11/YTypucT/YTypuct.py new file mode 100644 index 0000000..c5255ac --- /dev/null +++ b/Task 11/YTypucT/YTypuct.py @@ -0,0 +1,9 @@ +for i in range(2): + num = int(input()) + if num == 70: + print(70) + elif num == 68: + print(68) + elif num: + print (num) + else: print ('Ups') \ No newline at end of file diff --git a/Task 12/YTypucT/YTypucT.py b/Task 12/YTypucT/YTypucT.py new file mode 100644 index 0000000..cf41efd --- /dev/null +++ b/Task 12/YTypucT/YTypucT.py @@ -0,0 +1,10 @@ +num = 69 +str = "it's a string" + +if num and str[1] == 't': + print ('yep') +else: print('no') +if num == 69: + if len(str)>1: + print ('cool') + \ No newline at end of file diff --git a/Task 13/YTypucT/YTypucT.py b/Task 13/YTypucT/YTypucT.py new file mode 100644 index 0000000..ee44772 --- /dev/null +++ b/Task 13/YTypucT/YTypucT.py @@ -0,0 +1 @@ +print ('скипнул') \ No newline at end of file diff --git a/Task 14/YTypucT/YTypucT.py b/Task 14/YTypucT/YTypucT.py new file mode 100644 index 0000000..9cbbc22 --- /dev/null +++ b/Task 14/YTypucT/YTypucT.py @@ -0,0 +1,14 @@ +list = [13, 13, 13] +str = "it's a string!" +dict = { + 25: 'Word', + 'Key': 13 +} +for s in str: + print(s) +for el in list: + print(el) +for key in dict: + print(dict[key]) +for i in range(100, 50, -10): + print(i) \ No newline at end of file diff --git a/Task 15/YTypucT/YTypucT.py b/Task 15/YTypucT/YTypucT.py new file mode 100644 index 0000000..e288191 --- /dev/null +++ b/Task 15/YTypucT/YTypucT.py @@ -0,0 +1,13 @@ +list = [13, 1313, 131313, 666] + +for num in list: + if num > 5000: + print('Num ' + str(num) + ' greater than 5000') + continue + print(':c') + else: print('Num less than 5000') + +for num in list: + if num == 1313: + print('The number of found') + break \ No newline at end of file diff --git a/Task 16/YTypucT/YTypucT.py b/Task 16/YTypucT/YTypucT.py new file mode 100644 index 0000000..c5a7305 --- /dev/null +++ b/Task 16/YTypucT/YTypucT.py @@ -0,0 +1,16 @@ +num_1 = 10 +num_2 = 0 + +while num_1 > 0: + print(num_1) + num_1 -= 1 +else: print('Cycle completed') + +while num_2 != 10 or num_2 == 9: + if num_2 > 4: + print('Cool', num_2) + if num_2 == 8: + print('8. exit.') + break + num_2 += 1 + diff --git a/Task 17/YTypucT/YTypucT.py b/Task 17/YTypucT/YTypucT.py new file mode 100644 index 0000000..c2ea7e4 --- /dev/null +++ b/Task 17/YTypucT/YTypucT.py @@ -0,0 +1,14 @@ +list_1 = [[28, 70, 36], ['Line 1', "Line 2"]] +num_1 = 69 +num_2 = num_1 ** 1 +str_1 = 'Line' +num_3 = 0 + +for el_1 in list: + for el_2 in el_1: + print(el_2) + +while num_3 < 2: + for el in list[num_3]: + print(el) + num_3+=1 \ No newline at end of file diff --git a/Task 18/YTypucT/YTypucT.py b/Task 18/YTypucT/YTypucT.py new file mode 100644 index 0000000..08ccaa2 --- /dev/null +++ b/Task 18/YTypucT/YTypucT.py @@ -0,0 +1 @@ +print ("skip'нул") \ No newline at end of file diff --git a/Task 19/YTypucT/YTypucT.py b/Task 19/YTypucT/YTypucT.py new file mode 100644 index 0000000..08ccaa2 --- /dev/null +++ b/Task 19/YTypucT/YTypucT.py @@ -0,0 +1 @@ +print ("skip'нул") \ No newline at end of file diff --git a/Task 2/YTypucT/YTypucT.py b/Task 2/YTypucT/YTypucT.py new file mode 100644 index 0000000..7aa9bfc --- /dev/null +++ b/Task 2/YTypucT/YTypucT.py @@ -0,0 +1,16 @@ +num_1 = 1 + +num_1 + 5 +num_1 - 3 +num_1 * 4 +num_1 / 4 + +num_2 = 69 +num_2 += num_1 + +num_3 = 666 +num_3 -= num_2 + +num_4 =- num_3 + +print (num_1, num_2, num_3, num_4) \ No newline at end of file diff --git a/Task 20/YTypucT/YTypucT.py b/Task 20/YTypucT/YTypucT.py new file mode 100644 index 0000000..5927078 --- /dev/null +++ b/Task 20/YTypucT/YTypucT.py @@ -0,0 +1,13 @@ +def main (): + num_1 = func_1(int(input('Enter 1st number:')), int(input('Enter 2nd number:'))) + str_1 = func_2(input('Enter any line:')) + print (num_1) + print (str_1) + +def func_1(a, b): + return a ** b + +def func_2(str_1): + return str_1 + "!" + +main() \ No newline at end of file diff --git a/Task 21/YTypucT/YTypucT.py b/Task 21/YTypucT/YTypucT.py new file mode 100644 index 0000000..08ccaa2 --- /dev/null +++ b/Task 21/YTypucT/YTypucT.py @@ -0,0 +1 @@ +print ("skip'нул") \ No newline at end of file diff --git a/Task 22/YTypucT/YTypucT.py b/Task 22/YTypucT/YTypucT.py new file mode 100644 index 0000000..33a8717 --- /dev/null +++ b/Task 22/YTypucT/YTypucT.py @@ -0,0 +1,14 @@ +name = input ('Enter your first name: ') +age = int (input('Enter your age: ')) + +def main (): + func_1(name) + func_2(age) + +def func_1 (name): + print ('Hello ' + name + '!') + +def func_2 (age): + print ('Your age is '+ str(age) + '!') + +main() \ No newline at end of file diff --git a/Task 23/YtypucT/YTypucT.py b/Task 23/YtypucT/YTypucT.py new file mode 100644 index 0000000..d52daad --- /dev/null +++ b/Task 23/YtypucT/YTypucT.py @@ -0,0 +1,15 @@ +num_1 = 69 +str_1 = "It's a line" +list_1 = ["It's a list"] +dict_1 = {69: "it's a dictionary"} + +print(type(num_1), type(str_1), type(list_1), type(dict_1)) + +class Animal: + def __init__(self): + print('Animal class constructor') + +cat = Animal() + +print(type(cat)) +print(cat) \ No newline at end of file diff --git a/Task 24/YTypucT/YTypucT.py b/Task 24/YTypucT/YTypucT.py new file mode 100644 index 0000000..32af62b --- /dev/null +++ b/Task 24/YTypucT/YTypucT.py @@ -0,0 +1,10 @@ +class Animal: + def __init__(self, name, color, type = 'Animal'): + self.name = name + self.color = color + self.type = type + def out(self): + print ("It's a %s. It's name %s. It's a %s." % (self.type, self.name, self.color)) + +cat_1 = Animal(input('Enter name: '), input('Enter color: '), input('Enter type: ')) +cat_1.out() diff --git a/Task 25/YTypucT/YTypucT.py b/Task 25/YTypucT/YTypucT.py new file mode 100644 index 0000000..eeb0d4a --- /dev/null +++ b/Task 25/YTypucT/YTypucT.py @@ -0,0 +1,28 @@ +class Animal: + def __init__(self, kind): + self.kind = kind + def info(self): + print ("It's an %s" % (self.kind)) + +class Bird: + def __init__(self, kind): + self.kind = kind + def info(self): + print ("It's a %s." % (self.kind)) + +class Cat(Animal): + def __init__(self, name, color, kind = "Animal"): + super().__init__(kind) + self.__name = name + self.__color = color + +class Parrot(Bird): + def __init__(self, name, color, kind = "Bird"): + super().__init__(kind) + self.__name = name + self.__color = color + +cat = Cat('Bars', 'Green') +parrot = Parrot ('Popka', 'Red') +cat.info() +parrot.info() \ No newline at end of file diff --git a/Task 3/YTypucT/YTypucT.py b/Task 3/YTypucT/YTypucT.py new file mode 100644 index 0000000..516e885 --- /dev/null +++ b/Task 3/YTypucT/YTypucT.py @@ -0,0 +1,5 @@ +from math import sqrt +print (666) +print (int(sqrt(25-16)+66)) +num_1 = 13 +print (num_1, num_1**2, '|M a n y l e t t e r s|', 'two time '*2) \ No newline at end of file diff --git a/Task 4/YTypucT/YTypucT.py b/Task 4/YTypucT/YTypucT.py new file mode 100644 index 0000000..be20560 --- /dev/null +++ b/Task 4/YTypucT/YTypucT.py @@ -0,0 +1,6 @@ +str_1 = 'String' +str_2 = "another string" +str_3 = str_1 +str_3 += ' ' +str_3 += str_2 +print (str_1, str_2, str_3, sep = '\n') diff --git a/Task 5/YTypucT/YTypucT.py b/Task 5/YTypucT/YTypucT.py new file mode 100644 index 0000000..aa48561 --- /dev/null +++ b/Task 5/YTypucT/YTypucT.py @@ -0,0 +1,8 @@ +list_1 = [[], 8, 'String'] +list_2 = list_1 +print (list_2) +list_2.append(5) +list_2.remove(8) +list_2.reverse() +list_2.insert(2, ':)') +print (list_2) \ No newline at end of file diff --git a/Task 6/YTypucT/YTypucT.py b/Task 6/YTypucT/YTypucT.py new file mode 100644 index 0000000..989a51b --- /dev/null +++ b/Task 6/YTypucT/YTypucT.py @@ -0,0 +1,4 @@ +list_1 = ['ughm', 6] +list_2 = list_1[1] +list_1[0] += 'hrr' +print(list_1, list_2) \ No newline at end of file diff --git a/Task 7/YTypucT/YTypucT.py b/Task 7/YTypucT/YTypucT.py new file mode 100644 index 0000000..4fbefa8 --- /dev/null +++ b/Task 7/YTypucT/YTypucT.py @@ -0,0 +1,5 @@ +str_1 = "it's a string\n" +str_2 = "it's too, but this string is sad" +str_3 = str_1 + str_2 +str_4 = 'qwerty' +print (str_3, str_4[2], sep= '\n') \ No newline at end of file diff --git a/Task 8/YTypucT/YTypucT.py b/Task 8/YTypucT/YTypucT.py new file mode 100644 index 0000000..b6b2510 --- /dev/null +++ b/Task 8/YTypucT/YTypucT.py @@ -0,0 +1,11 @@ +list_1=[[6, 6, 6], ['he', 'he']] +print(list_1[0], list_1[1]) +num_1 = 8 +list_2 = list_1[0] +list_3 = list_1[num_1 - 7] +print(list_2, list_3) +num_2 = list_1[0][2] +num_3 = list_2[2] +num_4 = list_1[0][0] + list_1[0][1] - 6 +str_1 = list_1[1][0] +print(num_2, num_3, num_4, str_1) \ No newline at end of file diff --git a/Task 9/YTypucT/YTypucT.py b/Task 9/YTypucT/YTypucT.py new file mode 100644 index 0000000..32f82db --- /dev/null +++ b/Task 9/YTypucT/YTypucT.py @@ -0,0 +1,17 @@ +dict_1 = { + 'Я строка-ключ в словаре' : "Я строка-значение строки-ключа в словаре", + 50 : 93, + "Я другая строка-ключ в словаре" : ['Я строка в списке', 90], + 'Я ещё одна строка-ключ в словаре' : 32, + 73 : 'Я строка-значение числа-ключа в словаре', + "Я строка-ключ, моё значение - пустой словарь" : {}, +} +print(dict_1[73]) +del(dict_1[50]) +dict_1.update({ + 53 : 33, + 66 : 666 +}) +print(dict_1) +print(dict_1.values()) +print(dict_1.keys())