From 07e80a9d91f4f4835b74a8af2df88f0efa9bd593 Mon Sep 17 00:00:00 2001 From: Kayma21 <128317431+Kayma21@users.noreply.github.com> Date: Sun, 19 Mar 2023 23:18:39 +0300 Subject: [PATCH] lab 1 --- lesson_1/task_1.py | 2 ++ lesson_1/task_2.py | 22 ++++++++++++++++++++++ lesson_1/task_3.py | 3 +++ lesson_1/task_4.py | 5 +++++ lesson_1/task_5.py | 5 +++++ 5 files changed, 37 insertions(+) create mode 100644 lesson_1/task_1.py create mode 100644 lesson_1/task_2.py create mode 100644 lesson_1/task_3.py create mode 100644 lesson_1/task_4.py create mode 100644 lesson_1/task_5.py diff --git a/lesson_1/task_1.py b/lesson_1/task_1.py new file mode 100644 index 0000000..8e52953 --- /dev/null +++ b/lesson_1/task_1.py @@ -0,0 +1,2 @@ +a = list(map(float, input().split())) +print(sum(a)) \ No newline at end of file diff --git a/lesson_1/task_2.py b/lesson_1/task_2.py new file mode 100644 index 0000000..27650de --- /dev/null +++ b/lesson_1/task_2.py @@ -0,0 +1,22 @@ +a = input() +b_1, n_1 = input().split(sep='->') +b_2, n_2 = input().split(sep='->') +b_3, n_3 = input().split(sep='->') +total_1 = '' +total_2 = '' +total_3 = '' +for b in a: + while b == b_1: + b = n_1 + total_1 += b +print(total_1) +for b in total_1: + while b == b_2: + b = n_2 + total_2 += b +print(total_2) +for b in total_2: + while b == b_3: + b = n_3 + total_3 += b +print(total_3) diff --git a/lesson_1/task_3.py b/lesson_1/task_3.py new file mode 100644 index 0000000..80157f8 --- /dev/null +++ b/lesson_1/task_3.py @@ -0,0 +1,3 @@ +a = list(map(float, input().split())) +for n in a: + print(int(abs(n))) \ No newline at end of file diff --git a/lesson_1/task_4.py b/lesson_1/task_4.py new file mode 100644 index 0000000..87382cc --- /dev/null +++ b/lesson_1/task_4.py @@ -0,0 +1,5 @@ +a = list(map(float, input().split())) +total = 0 +for n in a: + total += n ** 2 +print(total) \ No newline at end of file diff --git a/lesson_1/task_5.py b/lesson_1/task_5.py new file mode 100644 index 0000000..8e5f832 --- /dev/null +++ b/lesson_1/task_5.py @@ -0,0 +1,5 @@ +a = input() +n = int(input()) +for b in a: + b = chr(ord(b)+n) + print(b, sep='', end='') \ No newline at end of file