From 0aece0d5f04c8f18e6332a3c218c96ad4f988f2a Mon Sep 17 00:00:00 2001 From: s498827 Date: Mon, 2 Dec 2024 19:19:02 +0100 Subject: [PATCH] =?UTF-8?q?Dodanie=20zada=C5=84=20do=20Lab1,=20Lab2,=20Lab?= =?UTF-8?q?3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lab1/zad5.py | 3 +++ Lab2/zad6.py | 9 +++++++++ Lab3/zad7.py | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 Lab1/zad5.py create mode 100644 Lab2/zad6.py create mode 100644 Lab3/zad7.py diff --git a/Lab1/zad5.py b/Lab1/zad5.py new file mode 100644 index 0000000..ba51b16 --- /dev/null +++ b/Lab1/zad5.py @@ -0,0 +1,3 @@ +x = list(map(int, input().split())) +x = x[slice(1, x[0]+1)] +print(min(x) * max(x)) diff --git a/Lab2/zad6.py b/Lab2/zad6.py new file mode 100644 index 0000000..38ba932 --- /dev/null +++ b/Lab2/zad6.py @@ -0,0 +1,9 @@ +queue = [1, 2, 3] + +queue.append(4) +queue.append(5) +print(f"Queue after adding elements: {queue}") + +queue.pop(0) +queue.pop(0) +print(f"Queue after removing elements: {queue}") \ No newline at end of file diff --git a/Lab3/zad7.py b/Lab3/zad7.py new file mode 100644 index 0000000..2786299 --- /dev/null +++ b/Lab3/zad7.py @@ -0,0 +1,20 @@ +def my_encode(message): + encoded_message = '' + for char in message: + encoded_message += chr(ord(char) + 7) + return encoded_message + + +def my_decode(message): + decoded_message = '' + for char in message: + decoded_message += chr(ord(char) - 7) + return decoded_message + + +message = "Witam" +encoded = my_encode(message) +decoded = my_decode(encoded) + +print(f" Encoded: {encoded}") +print(f"Decoded: {decoded}")