diff --git a/README.md b/README.md index f1ec59983..a0cbd51f8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # Базовый курс (моделирование на python) Репозиторий для прохождения базового курса по языку программирования python, в рамках общего цикла лекций "Моделирование на python". +print("747474") \ No newline at end of file diff --git a/domashka3rp.py b/domashka3rp.py new file mode 100644 index 000000000..a5608b1e1 --- /dev/null +++ b/domashka3rp.py @@ -0,0 +1,12 @@ +import time +start = time.time() +N = int(input()) +M = int(input()) +for i in range(M): + print(i) + time.sleep(1) + for el in range(N): + print(el) + time.sleep(1) +finish = time.time() +print(f'Время выполнения {finish-start}') \ No newline at end of file diff --git a/domashka4rp.py b/domashka4rp.py new file mode 100644 index 000000000..6b7cf8084 --- /dev/null +++ b/domashka4rp.py @@ -0,0 +1,9 @@ +import random +flowers = ['Тюльпан', 'Роза', "Люпин", "Борщевик"] +colors = ["White", 'Blue', 'Gray', 'Red', 'Yellow', 'Orange'] +lense = len(colors)-1 +for i in range(len(colors)): + colors[i] = colors[random.randint(0, lense)] +print(colors) +slownik = dict(zip(flowers, colors)) +print(slownik) diff --git a/domashkarp1.py b/domashkarp1.py new file mode 100644 index 000000000..cbf4ab88f --- /dev/null +++ b/domashkarp1.py @@ -0,0 +1,6 @@ +import random as rand +import numpy +N = int(input()) +mass1, mass2, mass3 = [rand.randint(0,100) for i in range(N)], [rand.randint(0,100) for i in range(N)],[rand.randint(0,100) for i in range(N)] +print(max(mass1 + mass2 + mass3)) +print(sum(mass1 + mass2 + mass3)) \ No newline at end of file diff --git a/domashkarp2.py b/domashkarp2.py new file mode 100644 index 000000000..639e41a4a --- /dev/null +++ b/domashkarp2.py @@ -0,0 +1,10 @@ +name = 'vladislavosadchenko' +myname ='_'.join(name) +myname1 = myname.upper() +myname2 = myname.lower() +ordmass1 = [ord(symbol) for symbol in myname1] +ordmass2 = [ord(symbol) for symbol in myname2] +print(ordmass1) +print(ordmass2) +print(f'Минимальное и максимальное для строки1 {min(ordmass1)}, {max(ordmass1)}') +print(f'Минимальное и максимальное для строки2 {min(ordmass2)}, {max(ordmass2)}') diff --git a/domashkarp5.py b/domashkarp5.py new file mode 100644 index 000000000..ec4fbcc17 --- /dev/null +++ b/domashkarp5.py @@ -0,0 +1,6 @@ +name = 'Borislov Osadchenko' +mass1 = [ord(symbol.upper()) for symbol in name] +mass2 = [ord(symbol.lower()) for symbol in name] +print(mass1) +print(mass2) +print(f'Сумма кодов списка: {sum(mass1 + mass2)}') \ No newline at end of file diff --git a/dopdomashka1.py b/dopdomashka1.py new file mode 100644 index 000000000..cf892cbe7 --- /dev/null +++ b/dopdomashka1.py @@ -0,0 +1,13 @@ +import random +N = int(input('Введи конечное число диапазона: ')) +count = int(input('Сколько чисел будет в списке: ')) +lista = [random.randint(0,100) for i in range(count)] +print(lista) +def notfoundnumber(b): + newnumber = random.randint(0, N) + while True: + if newnumber != b: + return newnumber +newnumbercall = list(map(notfoundnumber, lista )) +print(newnumbercall[0]) + diff --git a/dopdomashkarp.py b/dopdomashkarp.py new file mode 100644 index 000000000..0cb966227 --- /dev/null +++ b/dopdomashkarp.py @@ -0,0 +1,20 @@ +import numpy as np, time +def matima(n): + x = a*n**4 + b*n**3 + c**n*2 + d *n +e + return x +a, b, c, d, e = 5, 2, 9, 7, 256 +start = time.time() +count = list(np.arange(0, 10000)) +logic = list(map(matima, count)) +finish = time.time() +print(f'Время выполнения операции функцией map = {finish-start}') +start1 =time.time() +soso = [a*n**4 + b*n**3 + c**n*2 + d *n +e for n in range(0, 10000)] +finish1 = time.time() +print(f'Время выполнения операции списковым включением = {finish1-start1}') +start2 = time.time() +mass = [] +for n in range(0, 10000): + mass.append(a*n**4 + b*n**3 + c**n*2 + d *n +e) +finish2 = time.time() +print(f'Время выполнения операции циклом = {finish2-start2}') diff --git a/int_my_first_program.py b/int_my_first_program.py new file mode 100644 index 000000000..104f35292 --- /dev/null +++ b/int_my_first_program.py @@ -0,0 +1,4 @@ +import os +a = os.name +print(a) +print("Hello world!") \ No newline at end of file diff --git a/py.py b/py.py new file mode 100644 index 000000000..499fd1144 --- /dev/null +++ b/py.py @@ -0,0 +1,5 @@ +import dopdomashka1 +a = [67, 24, 31, 89, 28, 41, 92, 84, 48, 47, 28, 43, 92, 51, 63, 3, 13, 29, 69, 59, 59, 94, 22, 99, 1, 0, 7, 81, 21, 48, 76, 18, 45, 11, 50, 73, 13, 72, 100, 68, 45, 59, 95, 67, 61] +newa = list(map(str, a)) +lokomot = ' '.join(newa) +print(lokomot.find('39')) \ No newline at end of file