commit 0aece0d5f04c8f18e6332a3c218c96ad4f988f2a Author: s498827 Date: Mon Dec 2 19:19:02 2024 +0100 Dodanie zadaƄ do Lab1, Lab2, Lab3 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}")