diff --git a/dop1.py b/dop1.py new file mode 100644 index 000000000..b7b7cac11 --- /dev/null +++ b/dop1.py @@ -0,0 +1,12 @@ +a = int(input()) +b = int (input()) +c = int(input()) +D = b**2 - 4*a*c +if D < 0: + print('уравнение не имеет решения') +elif D== 0: + print('уравнение имеет один код', int(( -b + D**0.5) / (2*a))) +else: + print('уравнение имеет два корня:') + print(((-b+ D**0.5) / (2*a))) + print(((-b -D**0.5) / (2*a))) \ No newline at end of file diff --git a/lec_3_my_module.py b/lec_3_my_module.py new file mode 100644 index 000000000..e69de29bb diff --git a/lec_bool.py b/lec_bool.py new file mode 100644 index 000000000..61cebb753 --- /dev/null +++ b/lec_bool.py @@ -0,0 +1,13 @@ +print (bool(2)) + +print (bool("Good")) + +print (bool([1, 4 , 5])) + +print (bool(0)) + +print(bool('')) + +print(bool([])) + +print(bool([[]])) \ No newline at end of file diff --git a/lec_break_and_continue.py b/lec_break_and_continue.py new file mode 100644 index 000000000..1bfdb70ec --- /dev/null +++ b/lec_break_and_continue.py @@ -0,0 +1,9 @@ +for symbol in 'Hello world': + if symbol == 'o': + break + print(symbol) + +for symbol in 'Hello world': + if symbol =='o' or symbol== 'l': + continue + print(symbol) \ No newline at end of file diff --git a/lec_dop1.py b/lec_dop1.py new file mode 100644 index 000000000..e69de29bb diff --git a/lec_for.py b/lec_for.py new file mode 100644 index 000000000..af2c47fe8 --- /dev/null +++ b/lec_for.py @@ -0,0 +1,9 @@ +for i in 1, 3, 4: + print(i**2, end=' ') +for i in 1, 3, 4: + print(i**2, end='\n') +for i in 1, 3, 4: + print( i, i**2, sep=' - ') +a =[1, 5, 7, 10] +for i in a: + print(f'{i}**3 = {i**3}') \ No newline at end of file diff --git a/lec_if.py b/lec_if.py new file mode 100644 index 000000000..fc1c6ef1b --- /dev/null +++ b/lec_if.py @@ -0,0 +1,10 @@ +if 1 : + print("Hello 1") + +a = 3 +if a > 1 : + print(f'Hello {a}') + +b = 5 +if b == 5: + print(f'hello {b}') \ No newline at end of file diff --git a/lec_if_elif_else.py b/lec_if_elif_else.py new file mode 100644 index 000000000..1cfbe7f2a --- /dev/null +++ b/lec_if_elif_else.py @@ -0,0 +1,7 @@ +a = 3 +if a>5: + print("hello 5") +elif a<2: + print("hello 2") +else: + print("tupo hello") \ No newline at end of file diff --git a/lec_if_else.py b/lec_if_else.py new file mode 100644 index 000000000..0c81711bd --- /dev/null +++ b/lec_if_else.py @@ -0,0 +1,5 @@ +a = 3 +if a > 4: + print ("Hello 4") +else: + print(f"Hello {a}") \ No newline at end of file diff --git a/lec_logic_operation.py b/lec_logic_operation.py new file mode 100644 index 000000000..60e251e17 --- /dev/null +++ b/lec_logic_operation.py @@ -0,0 +1,10 @@ +a = 3 +b = 4 +c = 5 + +if a > 4 and b == 2: + print("Good") +elif b > 3 or c == 5: + print("Best") +else: + print("Bad") \ No newline at end of file diff --git a/lec_my_first_prgrm.py b/lec_my_first_prgrm.py new file mode 100644 index 000000000..9cf52cf0d --- /dev/null +++ b/lec_my_first_prgrm.py @@ -0,0 +1 @@ +print ("Hello world!") \ No newline at end of file diff --git a/lec_range.py b/lec_range.py new file mode 100644 index 000000000..9836a070a --- /dev/null +++ b/lec_range.py @@ -0,0 +1,11 @@ +a = range (0, 10, 2) +print(a) +print(type(a)) +print(a[3]) + +a ='Good' +for i in range(0, 10, 1): + if i < len(a): + print(a[i] + ' - Bad') + else: + print(f'{i}' + ' - Good') diff --git a/lec_slice.py b/lec_slice.py new file mode 100644 index 000000000..227dd1def --- /dev/null +++ b/lec_slice.py @@ -0,0 +1,20 @@ +import numpy as np + +a =[1, 5, 3, 6] +slice= a[0:2:1] +print(slice) + +slice = a[3: 0 :-1] +print(slice) + +slice = a[ : :-1] +print(slice) + +b = np.array([a, np.array(a)*3]) +print(b) + +slice = b[::, 1] +print(slice) + +slice = b[1,2:3:1] +print(slice) \ No newline at end of file diff --git a/lec_task1.py b/lec_task1.py new file mode 100644 index 000000000..28a428707 --- /dev/null +++ b/lec_task1.py @@ -0,0 +1,13 @@ +G = 6.67 * 10** (-1) +c = 3 * 10**8 +g = 9.81 +k = 1.38 * 10**(-23) +Na = 6.02 * 10**23 +R = 8.31 +p = 101325 +Vo = 2.24 * 10**(-2) +F = 9.4 * 10**4 +mp = 1.67 * 10**(-27) +k = 1.38 * 10**(-23) +e = 1.6 * 10**(-19) +h = 1.054 * 10**(-34) \ No newline at end of file diff --git a/lec_task2.py b/lec_task2.py new file mode 100644 index 000000000..852f76d61 --- /dev/null +++ b/lec_task2.py @@ -0,0 +1,17 @@ +import numpy as np +from math import cos, tan, radians, sqrt +h = 100 +a = radians(45) +b = radians(35) +g = 9.81 +V = sqrt((g * h * np.tan(np.radians(35))**2/ (2 * np.cos(np.radians(45))**2 *( 1 - np.tan(np.radians(35)) * np.tan(np.radians(45))))))**0.5 +print(V) + +import numpy as np +T = 200 +E = 300 +k = 1.38 * 10**(-23) +e = 1.6 * 10**(-19) +h = 1.054 * 10**(-34) +N = (2 / np.sqrt(np.pi)) * np.sqrt(h *(k * 200)**3) * np.exp(-300 / (k * 200)) +print(N) \ No newline at end of file diff --git a/lec_task3.py b/lec_task3.py new file mode 100644 index 000000000..8b7b9d7ae --- /dev/null +++ b/lec_task3.py @@ -0,0 +1,25 @@ +import numpy as np +g = 9.81 +x_0 = 0 +y_0 = 0 +v_0 = 15 +alpha = 45 * np.pi /180 +vx_0= v_0 * np.cos(alpha) +vy_0 = v_0 * np.sin(alpha) + +time= [] +x_coords = [] +y_coords = [] + +for t in np.arange(0, 5, 0.01): + x = x_0 + vx_0 * t + y = y_0 + vy_0 * t - g*t**2 /2 + + time.append(t) + x_coords.append(x) + y_coords.append(y) +print(t) +print(x) +print (y) + + diff --git a/lec_task5.py b/lec_task5.py new file mode 100644 index 000000000..e69de29bb diff --git a/lec_task6.py b/lec_task6.py new file mode 100644 index 000000000..30bb52136 --- /dev/null +++ b/lec_task6.py @@ -0,0 +1,10 @@ +import numpy as np +a = np.array([[2, 3, 1, 4, 5, 6, 7], + [8, 1, 3, 2, 2, 6, 8], + [1, 4, 3, 1, 0, 2, 5], + [4, 5, 0, 1, 3, 2, 1], + [8, 7, 9, 1, 0, 2, 3] ]) +slice = a[0:3:1,0:2:1 ] +print(slice) +slice = a[1:3, 3:5:1] +print(slice) diff --git a/lec_while.py b/lec_while.py new file mode 100644 index 000000000..5351f4a28 --- /dev/null +++ b/lec_while.py @@ -0,0 +1,4 @@ +i = 5 +while i < 15 : + print('i:', i) + i += 2 diff --git a/task1.py b/task1.py new file mode 100644 index 000000000..5f25b3a96 --- /dev/null +++ b/task1.py @@ -0,0 +1,5 @@ +a = int(input()) +if a % 2 == 0: + print("четное") +else: + print("нечетное") \ No newline at end of file diff --git a/task2.py b/task2.py new file mode 100644 index 000000000..ba758e9ab --- /dev/null +++ b/task2.py @@ -0,0 +1,5 @@ +a = int(input('первый член прогрессии: ')) +b = int(input('знаменатель прогрессии: ')) +c = int(input('количество членов прогрессии: ')) +for i in range(1, c + 1): + print(f'член {i} = {a * b**(i -1)}') \ No newline at end of file diff --git a/task3.py b/task3.py new file mode 100644 index 000000000..ed2693ec7 --- /dev/null +++ b/task3.py @@ -0,0 +1,5 @@ +year = int(input()) +if year % 4 == 0: + print(f'{year} високосный') +else: + print(f'{year} невисокосный') \ No newline at end of file diff --git a/task4.py b/task4.py new file mode 100644 index 000000000..340ae1b66 --- /dev/null +++ b/task4.py @@ -0,0 +1,8 @@ +a = int(input('число: ')) +b = [1] +for i in range(1, a+1): + if i ==1: + b.append(i) + else: + b.append(b[i-2]+b[i -1]) + print(b) diff --git a/task5.py b/task5.py new file mode 100644 index 000000000..e04fd32e2 --- /dev/null +++ b/task5.py @@ -0,0 +1,10 @@ +a = int(input()) +b = int(input()) +if a % b == 0: + print('первое число делится на второе') + print(f'остаток {a%b}') + print(f'a/b = {int(a/b)}') +else: + print('первое число не делится на второе') + print(f'остаток{a%b}') + print( f'a/b = {int(a/b)}') diff --git a/task6.py b/task6.py new file mode 100644 index 000000000..b0208a907 --- /dev/null +++ b/task6.py @@ -0,0 +1,12 @@ +a = 1 +b = 2 +c = 3 +d = 4 +e = 5 +f = 6 +g = 7 +h = 8 +i = 9 +for i in range (1, 10): + print(a*i, b*i, c*i, d*i, e*i, f*i, g*i, h*i,) +