Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added __pycache__/constants.cpython-312.pyc
Binary file not shown.
Binary file added __pycache__/lec_create_func.cpython-312.pyc
Binary file not shown.
11 changes: 11 additions & 0 deletions constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
gravitational_constant = 6,67 * 10 ** -11
speed_of_light = 3 * 10 ** 8
avogadro_constant = 6.02214076 * 10 ** 23
planck_constant = 6.62607015 * 10 ** 34
first_radiation_constant = 3.741771852 * 10 ** -16
elementary_charge = 1.602176634 * 10 ** -19
boltzmann_constant = 1.380649 * 10 ** -23
electron_mass = 9.1093837139 * 10 ** -31
conductance_quantum = 7.748091729 * 10 ** -5
molar_planck_constant = 3.9903127128934314 * 10 ** -10
g = 9.8
8 changes: 8 additions & 0 deletions lec_args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def my_func(a, b):
x = 3 * a - b
return x

tmp = my_func()



9 changes: 9 additions & 0 deletions lec_call_func.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from lec_create_func import mult_func
from lec_create_func import print_func
tmp = mult_func(4)
print(tmp)
print(mult_func(10))
print(mult_func('Good '))

print_func('hello')
print_func(mult_func('50'))
6 changes: 6 additions & 0 deletions lec_create_func.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def mult_func(a):
x = a * 3
return x

def print_func(a):
print(f'Мой принт с юлэкджеком {a}')
44 changes: 44 additions & 0 deletions lec_data_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
def changer(a , b):
a = 2
b[0] = 'Good'

x = 10
L = [1, 2]

changer(x, L)
print(x)
print(L)

L = [1, 2]
changer(x, L[:])
# complex
x = 3
y = 4

z = complex(x,y)
print(z)

w = complex(y, x)
print(z + w)
# str
s = 'hello'
print(s[0])

#s[0] = 'p'
#print(s)
#tuple
t = (1,4,9)
print(t)
print(t[0])
#t[0] = 3
#list
l = [1,4,9]
print(l)
print(l[0])
l[0] = 3
print(l)
# dict
d = {'a1':4, 4:'a1', 'str':'Hello'}
print(d['a1'])
print(d['str'])
d['str'] = 'Good'
12 changes: 12 additions & 0 deletions lec_scop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
x0 = 10 # глобальная область видимости
def move(t):
x = x0 * t #
return x # локальная область видимости
print(move(10))
#print(x)
a = 'Good'
def my_func():
a = 'Bad'
print(a)
my_func()
print(a)
9 changes: 9 additions & 0 deletions task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def arithmetic_mean(arr):
x = 0
for i in range(len(arr)):
x += arr[i]
return x / len(arr)

array = [1, 2, 3, 4, 5]

print(arithmetic_mean(array))
7 changes: 7 additions & 0 deletions task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import numpy as np

def multiply_elements(arr):
return np.prod(arr)

array = np.array([1, 2, 3, 4, 5])
print(multiply_elements(array))
16 changes: 16 additions & 0 deletions task3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from constants import g

def mech_energy(mass, height, speed):

p_energy = mass * g * height

k_energy = 0.5 * mass * speed**2

energy = p_energy + k_energy
return energy

mass = int(input('Введите массу: '))
height = int(input('Введите высоту: '))
speed = int(input('Введите скорость: '))

print(mech_energy(mass, height, speed))
15 changes: 15 additions & 0 deletions task4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import numpy as np

def values(a, b, N):

x = np.linspace(a, b, N)

y = x ** 2

return y


a = int(input('Введите первый промежуток'))
b = int(input('Введите второй промежуток'))
N = int(input('Введите число точек'))
print(values(a, b, N))
25 changes: 25 additions & 0 deletions task5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import numpy as np

def calculate_area(shape):
if shape == 'круг':
radius = int(input("Введите радиус круга: "))
area = np.pi * radius ** 2
return area
elif shape == 'прямоугольник':
length = int(input("Введите длину прямоугольника: "))
width = int(input("Введите ширину прямоугольника: "))
area = length * width
return area
elif shape == 'треугольник':
base = int(input("Введите основание треугольника: "))
height = int(input("Введите высоту треугольника: "))
area = 0.5 * base * height
return area
else:
return "Некорректная фигура!"


user_shape = input("Введите фигуру (круг, прямоугольник, треугольник): ")
area = calculate_area(user_shape)

print(f"Площадь {user_shape} составляет: {area}")