{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "23ed41a0-7a05-493e-a640-4bfb10c42164", "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "id": "fa3799c5-d3a0-4967-98d4-a340d19dbfc6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[10 11 12 13 14 15 16 17 18 19 20]\n", "(11,)\n", "\n" ] } ], "source": [ "#Zadanie 1.1\n", "# Tworzenie tablicy jednowymiarowej\n", "arr = np.array([10,11,12,13,14,15,16,17,18,19,20])\n", "print(arr)\n", "print(arr.shape)\n", "print(type(arr))\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "b6b4fa7d-7ee5-416c-8060-39057b49d77b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[10 20]\n", " [30 40]\n", " [50 60]]\n", "(3, 2)\n", "\n" ] } ], "source": [ "# Zadanie 1.2\n", "arr = np.array([[10, 20], [30, 40], [50, 60]])\n", "\n", "print(arr)\n", "\n", "print(arr.shape)\n", "\n", "print(type(arr))" ] }, { "cell_type": "code", "execution_count": 4, "id": "f96f774c-d6cd-440f-b6bf-a2d373404de3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[1 2 3]\n", " [4 5 6]\n", " [7 8 9]]\n", "8\n", "[[7 8 9]]\n", "[3 6 9]\n", "[[5 6]\n", " [8 9]]\n" ] } ], "source": [ "# Zadanie 2\n", "# Tworzenie dwuwymiarowej tablicy\n", "arr = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n", "\n", "print(arr)\n", "\n", "\n", "print(arr[2, 1])\n", "\n", "print(arr[2:])\n", "\n", "\n", "print(arr[:,2])\n", "\n", "print(arr[1:,1:])\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "43216855-9d5d-4d03-9512-557f4d228571", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[10 20 30 40]\n", "int64\n", "[10. 20. 30. 40.]\n", "float32\n", "['Python' 'NumPy' 'Coding']\n", "