Initial commit
This commit is contained in:
12
Lab_2/Task_1.py
Normal file
12
Lab_2/Task_1.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from math import *
|
||||
|
||||
try:
|
||||
x = float(input("Введіть значення x: ").replace(",", "."))
|
||||
y = float(input("Введіть значення y: ").replace(",", "."))
|
||||
|
||||
r = (pow(e, 2 * x) + sin(y)) / (log10(3.8 * x + y))
|
||||
|
||||
print(f"R = {r}")
|
||||
|
||||
except Exception as err:
|
||||
print("Error ocured:", err)
|
||||
22
Lab_2/Task_2.py
Normal file
22
Lab_2/Task_2.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from math import *
|
||||
|
||||
try:
|
||||
a = float(input("Введіть число a: ").replace(",", "."))
|
||||
b = float(input("Введіть число b: ").replace(",", "."))
|
||||
|
||||
sqr_of_sum = pow(a+b, 2)
|
||||
sum_of_sqr = pow(a, 2) + pow(b, 2)
|
||||
|
||||
print(f"Квадрат суми = {sqr_of_sum}")
|
||||
print(f"Сума квадратів = {sum_of_sqr}")
|
||||
|
||||
if sqr_of_sum > sum_of_sqr:
|
||||
print("Квадрат суми - більше.")
|
||||
elif sum_of_sqr > sqr_of_sum:
|
||||
print("Сума квадратів - більше.")
|
||||
else:
|
||||
print("Квадрат суми та сума квадратів рівні.")
|
||||
|
||||
|
||||
except Exception as err:
|
||||
print("Error ocured:", err)
|
||||
13
Lab_2/Task_3.py
Normal file
13
Lab_2/Task_3.py
Normal file
@@ -0,0 +1,13 @@
|
||||
try:
|
||||
a = int(input("Введіть число a: "))
|
||||
b = int(input("Введіть число b: "))
|
||||
|
||||
if a < b:
|
||||
numbers = [i for i in range(a, b+1)]
|
||||
print(*numbers)
|
||||
print(len(numbers))
|
||||
else:
|
||||
print("Error ocured: A>B")
|
||||
|
||||
except Exception as err:
|
||||
print("Error ocured:", err)
|
||||
13
Lab_2/Test.sh
Normal file
13
Lab_2/Test.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
# !/bin/sh
|
||||
|
||||
for i in $(seq -1 0.5 1);
|
||||
do
|
||||
for j in $(seq -1 0,5 1)
|
||||
do
|
||||
|
||||
printf "Probe x = $i $((i * 2))\n";
|
||||
printf "%s\n%s\n" "$i" "$j" | python3 dummy.py;
|
||||
printf "\n";
|
||||
sleep 0.25;
|
||||
done
|
||||
done
|
||||
2
Lab_2/dummy.py
Normal file
2
Lab_2/dummy.py
Normal file
@@ -0,0 +1,2 @@
|
||||
print(input().replace(",", "."))
|
||||
print(input().replace(",", "."))
|
||||
Reference in New Issue
Block a user