{\rtf1\ansi\ansicpg1250\deff0\nouicompat\deflang1045{\fonttbl{\f0\fnil\fcharset238 Calibri;}{\f1\fnil\fcharset0 Calibri;}{\f2\fnil Calibri;}{\f3\fnil\fcharset1 Cambria Math;}} {\*\generator Riched20 10.0.19041}{\*\mmathPr\mmathFont3\mwrapIndent1440 }\viewkind4\uc1 \pard\sa200\sl276\slmult1\f0\fs32 Zadanie domowe 5\par Zad 1\par import random\par polish_chars = "A\'a5BC\'c6DE\'caFGHIJKLMNO\f1\lang1033\'d3PRS\f0\'8cTUWYZ\'8f\'af" + "a\'b9bc\'e6de\'eafghijklmno\f1\'f3prs\f0\'9ctuwyz\'9f\'bf"\par + "0123456789"\par polish_text_content = ''.join(random.choices(polish_chars, k=100000))\par with open('generated_polish_text_100000_chars.txt', 'w', encoding='utf-8') as\par file:\par file.write(polish_text_content)\par print("File generated successfully.")\par \b Plik tekstowy\f1 :\f0\lang1045 \f1\lang1033 100 KB.\par Po kompresji ZIP \f0\lang1045 najmniejszy\f1\lang1033 : 1\f2\endash 3 KB \f0 .\par Po kompresji ZIP najwi\'eakszy: 28\f2\endash 30 \f0\lang1045 KB\f2\lang1033 .\f0\par \b0 Zad 2\par from PIL import Image\par import numpy as np\par width, height = 1200, 800\par image_data = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8)\par image_bmp = Image.fromarray(image_data)\par bmp_file_path = '/mnt/data/generated_image.bmp'\par image_bmp.save(bmp_file_path, format='BMP')\par bmp_file_path\par \b BMP (oryginalny): 2,880,054 bajty\par PNG: 2,884,857 bajt\f1\'f3w (stopie\f0\'f1 kompresji: ~1.00)\par GIF: 1,306,326 bajt\f1\'f3w (stopie\f0\'f1 kompresji: ~2.20)\par JPEG: 577,436 bajt\f1\'f3w (stopie\f0\'f1 kompresji: ~4.99)\par \b0\par Zad 3\par H = log\f3\u-10187?\u-8240?\f1 (\f3\u-10187?\u-9073?\f0\lang1045 ^\f3\u-10187?\u-8240?\f1 )\par log\f3\u-10187?\u-8240?\f1 (\f3\u-10187?\u-9073?\f0\lang1045 ^\f3\u-10187?\u-8240?\f1 ) = 2log\f3\u-10187?\u-8240?\f1 (\f3\u-10187?\u-9073?\f1 )\par Entropia tego \f0\'9fr\f1\'f3d\f0\'b3a wynosi 2log\f3\u-10187?\u-8240?\f1 (\f3\u-10187?\u-9073?\f1 ) bit\'f3w.\f0\lang1033\par }