Dodanie zadań do Lab1, Lab2, Lab3
This commit is contained in:
commit
0aece0d5f0
3
Lab1/zad5.py
Normal file
3
Lab1/zad5.py
Normal file
@ -0,0 +1,3 @@
|
||||
x = list(map(int, input().split()))
|
||||
x = x[slice(1, x[0]+1)]
|
||||
print(min(x) * max(x))
|
9
Lab2/zad6.py
Normal file
9
Lab2/zad6.py
Normal file
@ -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}")
|
20
Lab3/zad7.py
Normal file
20
Lab3/zad7.py
Normal file
@ -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}")
|
Loading…
Reference in New Issue
Block a user