@@ -357,10 +357,10 @@ msgid ""
357357"Second line."
358358msgstr ""
359359">>> s = 'Pierwsza linia.\\ nDruga linia.' # \\ n oznacza nową linię\n"
360- ">>> s # bez print(), znaki specjalne są zawarte w ciągu znaków\n"
360+ ">>> s # bez print(), znaki specjalne są zawarte w ciągu znaków\n"
361361"'Pierwsza linia.\\ nDruga linia.'\n"
362- ">>> print(s) # z print(), znaki specjalne są interpretowane, więc \\ n tworzy "
363- "nową linię\n"
362+ ">>> print(s) # z print(), znaki specjalne są interpretowane, więc \\ n "
363+ "tworzy nową linię\n"
364364"Pierwsza linia.\n"
365365"Druga linia."
366366
@@ -380,10 +380,10 @@ msgid ""
380380">>> print(r'C:\\ some\\ name') # note the r before the quote\n"
381381"C:\\ some\\ name"
382382msgstr ""
383- ">>> print('C:\\ jakas\\ nazwa') # tutaj \\ n oznacza nową linię!\n"
383+ ">>> print('C:\\ jakas\\ nazwa') # tutaj \\ n oznacza nową linię!\n"
384384"C:\\ jakas\n"
385385"azwa\n"
386- ">>> print(r'C:\\ jakas\\ nazwa') # zwróć uwagę na r przed cudzysłowem\n"
386+ ">>> print(r'C:\\ jakas\\ nazwa') # zwróć uwagę na r przed cudzysłowem\n"
387387"C:\\ jakas\\ nazwa"
388388
389389msgid ""
@@ -498,7 +498,7 @@ msgid ""
498498"SyntaxError: invalid syntax"
499499msgstr ""
500500">>> prefix = 'Py'\n"
501- ">>> prefiks 'thon' # nie można łączyć zmiennej i literału ciagu znaków\n"
501+ ">>> prefiks 'thon' # nie można łączyć zmiennej i literału ciagu znaków\n"
502502" File \" <stdin>\" , line 1\n"
503503" prefix 'thon'\n"
504504" ^^^^^^\n"
@@ -537,9 +537,9 @@ msgid ""
537537"'n'"
538538msgstr ""
539539">>> word = 'Python'\n"
540- ">>> word[0] # znak na pozycji 0\n"
540+ ">>> word[0] # znak na pozycji 0\n"
541541"'P'\n"
542- ">>> word[5] # znak na pozycji 5\n"
542+ ">>> word[5] # znak na pozycji 5\n"
543543"'n'"
544544
545545msgid ""
@@ -555,6 +555,12 @@ msgid ""
555555">>> word[-6]\n"
556556"'P'"
557557msgstr ""
558+ ">>> word[-1] # ostatni znak\n"
559+ "'n'\n"
560+ ">>> word[-2] # przedostatni znak\n"
561+ "'o'\n"
562+ ">>> word[-6]\n"
563+ "'P'"
558564
559565msgid "Note that since -0 is the same as 0, negative indices start from -1."
560566msgstr ""
@@ -575,6 +581,10 @@ msgid ""
575581">>> word[2:5] # characters from position 2 (included) to 5 (excluded)\n"
576582"'tho'"
577583msgstr ""
584+ ">>> word[0:2] # znaki od pozycji 0 (włącznie) do 2 (wyłącznie)\n"
585+ "'Py'\n"
586+ ">>> word[2:5] # znaki od pozycji 2 (włącznie) do 5 (wyłącznie)\n"
587+ "'tho'"
578588
579589msgid ""
580590"Slice indices have useful defaults; an omitted first index defaults to zero, "
@@ -592,6 +602,12 @@ msgid ""
592602">>> word[-2:] # characters from the second-last (included) to the end\n"
593603"'on'"
594604msgstr ""
605+ ">>> word[:2] # znak od początku do pozycji 2 (wyłącznie)\n"
606+ "'Py'\n"
607+ ">>> word[4:] # znak od pozycji 4 (włącznie) do końca\n"
608+ "'on'\n"
609+ ">>> word[-2:] # znak od przedostatniego (włącznie) do końca\n"
610+ "'on'"
595611
596612msgid ""
597613"Note how the start is always included, and the end always excluded. This "
@@ -606,6 +622,10 @@ msgid ""
606622">>> word[:4] + word[4:]\n"
607623"'Python'"
608624msgstr ""
625+ ">>> word[:2] + word[2:]\n"
626+ "'Python'\n"
627+ ">>> word[:4] + word[4:]\n"
628+ "'Python'"
609629
610630msgid ""
611631"One way to remember how slices work is to think of the indices as pointing "
@@ -625,6 +645,11 @@ msgid ""
625645" 0 1 2 3 4 5 6\n"
626646"-6 -5 -4 -3 -2 -1"
627647msgstr ""
648+ " +---+---+---+---+---+---+\n"
649+ " | P | y | t | h | o | n |\n"
650+ " +---+---+---+---+---+---+\n"
651+ " 0 1 2 3 4 5 6\n"
652+ "-6 -5 -4 -3 -2 -1"
628653
629654msgid ""
630655"The first row of numbers gives the position of the indices 0...6 in the "
@@ -653,6 +678,10 @@ msgid ""
653678" File \" <stdin>\" , line 1, in <module>\n"
654679"IndexError: string index out of range"
655680msgstr ""
681+ ">>> word[42] # word ma tylko 6 znaków\n"
682+ "Traceback (most recent call last):\n"
683+ " File \" <stdin>\" , line 1, in <module>\n"
684+ "IndexError: string index out of range"
656685
657686msgid ""
658687"However, out of range slice indexes are handled gracefully when used for "
@@ -667,6 +696,10 @@ msgid ""
667696">>> word[42:]\n"
668697"''"
669698msgstr ""
699+ ">>> word[4:42]\n"
700+ "'on'\n"
701+ ">>> word[42:]\n"
702+ "''"
670703
671704msgid ""
672705"Python strings cannot be changed --- they are :term:`immutable`. Therefore, "
@@ -686,6 +719,14 @@ msgid ""
686719" File \" <stdin>\" , line 1, in <module>\n"
687720"TypeError: 'str' object does not support item assignment"
688721msgstr ""
722+ ">>> word[0] = 'J'\n"
723+ "Traceback (most recent call last):\n"
724+ " File \" <stdin>\" , line 1, in <module>\n"
725+ "TypeError: 'str' object does not support item assignment\n"
726+ ">>> word[2:] = 'py'\n"
727+ "Traceback (most recent call last):\n"
728+ " File \" <stdin>\" , line 1, in <module>\n"
729+ "TypeError: 'str' object does not support item assignment"
689730
690731msgid "If you need a different string, you should create a new one::"
691732msgstr ""
@@ -697,6 +738,10 @@ msgid ""
697738">>> word[:2] + 'py'\n"
698739"'Pypy'"
699740msgstr ""
741+ ">>> 'J' + word[1:]\n"
742+ "'Jython'\n"
743+ ">>> word[:2] + 'py'\n"
744+ "'Pypy'"
700745
701746msgid "The built-in function :func:`len` returns the length of a string::"
702747msgstr "Wbudowana funkcja :func:`len` zwraca długość ciągu::"
@@ -706,6 +751,9 @@ msgid ""
706751">>> len(s)\n"
707752"34"
708753msgstr ""
754+ ">>> s = 'superkalifradalistodekspialitycznie'\n"
755+ ">>> len(s)\n"
756+ "35"
709757
710758msgid ":ref:`textseq`"
711759msgstr ":ref:`textseq`"
@@ -770,6 +818,9 @@ msgid ""
770818">>> squares\n"
771819"[1, 4, 9, 16, 25]"
772820msgstr ""
821+ ">>> squares = [1, 4, 9, 16, 25]\n"
822+ ">>> squares\n"
823+ "[1, 4, 9, 16, 25]"
773824
774825msgid ""
775826"Like strings (and all other built-in :term:`sequence` types), lists can be "
@@ -787,6 +838,12 @@ msgid ""
787838">>> squares[-3:] # slicing returns a new list\n"
788839"[9, 16, 25]"
789840msgstr ""
841+ ">>> squares[0] # indeksowanie zwraca element\n"
842+ "1\n"
843+ ">>> squares[-1]\n"
844+ "25\n"
845+ ">>> squares[-3:] # slicing zwraca nową listę\n"
846+ "[9, 16, 25]"
790847
791848msgid "Lists also support operations like concatenation::"
792849msgstr "Listy wspierają też operacje takie jak łączenie::"
@@ -795,6 +852,8 @@ msgid ""
795852">>> squares + [36, 49, 64, 81, 100]\n"
796853"[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]"
797854msgstr ""
855+ ">>> squares + [36, 49, 64, 81, 100]\n"
856+ "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]"
798857
799858msgid ""
800859"Unlike strings, which are :term:`immutable`, lists are a :term:`mutable` "
@@ -812,6 +871,12 @@ msgid ""
812871">>> cubes\n"
813872"[1, 8, 27, 64, 125]"
814873msgstr ""
874+ ">>> cubes = [1, 8, 27, 65, 125] # coś tu jest nie tak\n"
875+ ">>> 4 ** 3 # sześcian 4 to 64, a nie 65!\n"
876+ "64\n"
877+ ">>> cubes[3] = 64 # zastąp nieprawidłową wartość\n"
878+ ">>> cubes\n"
879+ "[1, 8, 27, 64, 125]"
815880
816881msgid ""
817882"You can also add new items at the end of the list, by using the :meth:`!list."
@@ -826,6 +891,10 @@ msgid ""
826891">>> cubes\n"
827892"[1, 8, 27, 64, 125, 216, 343]"
828893msgstr ""
894+ ">>> cubes.append(216) # dodaj sześcian 6\n"
895+ ">>> cubes.append(7 ** 3) # i sześcian 7\n"
896+ ">>> cubes\n"
897+ "[1, 8, 27, 64, 125, 216, 343]"
829898
830899msgid ""
831900"Simple assignment in Python never copies data. When you assign a list to a "
@@ -847,6 +916,13 @@ msgid ""
847916">>> rgb\n"
848917"[\" Red\" , \" Green\" , \" Blue\" , \" Alph\" ]"
849918msgstr ""
919+ ">>> rgb = [\" czerwony\" , \" zielony\" , \" niebieski\" ]\n"
920+ ">>> rgba = rgb\n"
921+ ">>> id(rgb) == id(rgba) # odwołują się do tego samego obiektu\n"
922+ "True\n"
923+ ">>> rgba.append(\" alfa\" )\n"
924+ ">>> rgb\n"
925+ "[\" czerwony\" , \" zielony\" , \" niebieski\" , \" alpha\" ]"
850926
851927msgid ""
852928"All slice operations return a new list containing the requested elements. "
@@ -865,6 +941,12 @@ msgid ""
865941">>> rgba\n"
866942"[\" Red\" , \" Green\" , \" Blue\" , \" Alph\" ]"
867943msgstr ""
944+ ">>> correct_rgba = rgba[:]\n"
945+ ">>> correct_rgba[-1] = \" alfa\" \n"
946+ ">>> correct_rgba\n"
947+ "[\" czerwony\" , \" zielony\" , \" niebieski\" , \" alfa\" ]\n"
948+ ">>> rgba\n"
949+ "[\" czerwony\" , \" zielony\" , \" niebieski\" , \" alfa\" ]"
868950
869951msgid ""
870952"Assignment to slices is also possible, and this can even change the size of "
@@ -890,6 +972,21 @@ msgid ""
890972">>> letters\n"
891973"[]"
892974msgstr ""
975+ ">>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']\n"
976+ ">>> litery\n"
977+ "['a', 'b', 'c', 'd', 'e', 'f', 'g']\n"
978+ ">>> # zastąp niektóre wartości\n"
979+ ">>> letters[2:5] = ['C', 'D', 'E']\n"
980+ ">>> litery\n"
981+ "['a', 'b', 'C', 'D', 'E', 'f', 'g']\n"
982+ ">>> # teraz je usuń\n"
983+ ">>> letters[2:5] = []\n"
984+ ">>> letters\n"
985+ "['a', 'b', 'f', 'g']\n"
986+ ">>> # wyczyść listę zastępując wszystkie elementy pustą listą\n"
987+ ">>> letters[:] = []\n"
988+ ">>> letters[:]\n"
989+ "[]"
893990
894991msgid "The built-in function :func:`len` also applies to lists::"
895992msgstr "Wbudowana funkcja :func:`len` ma również zastosowanie do list::"
@@ -899,6 +996,9 @@ msgid ""
899996">>> len(letters)\n"
900997"4"
901998msgstr ""
999+ ">>> letters = ['a', 'b', 'c', 'd']\n"
1000+ ">>> len(letters)\n"
1001+ "4"
9021002
9031003msgid ""
9041004"It is possible to nest lists (create lists containing other lists), for "
@@ -917,6 +1017,15 @@ msgid ""
9171017">>> x[0][1]\n"
9181018"'b'"
9191019msgstr ""
1020+ ">>> a = ['a', 'b', 'c']\n"
1021+ ">>> n = [1, 2, 3]\n"
1022+ ">>> x = [a, n]\n"
1023+ ">>> x\n"
1024+ "[['a', 'b', 'c'], [1, 2, 3]]\n"
1025+ ">>> x[0]\n"
1026+ "['a', 'b', 'c']\n"
1027+ ">>> x[0][1]\n"
1028+ "'b'"
9201029
9211030msgid "First Steps Towards Programming"
9221031msgstr "Pierwsze kroki do programowania"
@@ -948,6 +1057,20 @@ msgid ""
9481057"5\n"
9491058"8"
9501059msgstr ""
1060+ ">>> # ciąg Fibonacciego:\n"
1061+ ">>> # suma dwóch elementów określa następny\n"
1062+ ">>> a, b = 0, 1\n"
1063+ ">>> while a < 10:\n"
1064+ "... print(a)\n"
1065+ "... a, b = b, a+b\n"
1066+ "...\n"
1067+ "0\n"
1068+ "1\n"
1069+ "1\n"
1070+ "2\n"
1071+ "3\n"
1072+ "5\n"
1073+ "8"
9511074
9521075msgid "This example introduces several new features."
9531076msgstr "Ten przykład wprowadza kilka nowych funkcji."
@@ -1026,6 +1149,9 @@ msgid ""
10261149">>> print('The value of i is', i)\n"
10271150"The value of i is 65536"
10281151msgstr ""
1152+ ">>> i = 256*256\n"
1153+ ">>> print('Wartość i wynosi', i)\n"
1154+ "Wartość i wynosi 65536"
10291155
10301156msgid ""
10311157"The keyword argument *end* can be used to avoid the newline after the "
@@ -1042,6 +1168,12 @@ msgid ""
10421168"...\n"
10431169"0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,"
10441170msgstr ""
1171+ ">>> a, b = 0, 1\n"
1172+ ">>> while a < 1000:\n"
1173+ "... print(a, end=',')\n"
1174+ "... a, b = b, a+b\n"
1175+ "...\n"
1176+ "0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987,"
10451177
10461178msgid "Footnotes"
10471179msgstr "Przypisy"
0 commit comments