diff --git a/#task1.py b/#task1.py new file mode 100644 index 0000000..4bfd0ea --- /dev/null +++ b/#task1.py @@ -0,0 +1,55 @@ +#task2 +def count_sheeps(sheep): + return sheep.count(True) + + +#task3 +def monkey_count(n): + result = [] + for num in range(1, n + 1): + result.append(num) + return result +monkey_count(10) + + +#task4 +def paperwork(n, m): + return n * m if n > 0 and m > 0 else 0 +paperwork(10,16) + + +#task5 +def hero(b, d): + bulletsneeded = d * 2 + if b >= bulletsneeded: + return True + else: + return False +hero(30,10) +#task1 +def polish_letters(s): + polish = {"ą": "a", "ć": "c", "ę": "e", "ł": "l", "ń": "n", "ó": "o", "ś": "s", "ź": "z", "ż": "z"} + return "".join([polish[c] if c in polish else c for c in s]) + +#task2 +def sum_of_minimums(numbers): + result = 0 + for i in numbers: + result += min(i) + return result + + + +#task3 +list = [] + + +def find_all(list, x): + l = len(list) + result = [] + for i in range(0,l): + if x == list[i]: + result.append(i) + return result + + \ No newline at end of file diff --git a/lab1.py b/lab1.py new file mode 100644 index 0000000..5001171 --- /dev/null +++ b/lab1.py @@ -0,0 +1,29 @@ +import math + +a = 0.1 +b = 0.5 + + +def y(x): + return (a + (math.tan(b * x)) ** 2) / (b + (1/math.tan(a * x)) ** 2) + + +# task №17 A +print("task №17 A") + +x_first = 0.15 +x_last = 1.37 +step = 0.25 + +x = x_first +while x < x_last: + print(f"x = {x} y = {y(x)}") + x += step + +# task №17 B +print("task №17 B") + +array_x = [0.2, 0.3, 0.44, 0.6, 0.56] +for x in array_x: + print(f"x = {x} y = {y(x)}") +