@@ -803,6 +803,17 @@ msgid ""
803803">>> fib(2000)\n"
804804"0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597"
805805msgstr ""
806+ ">>> def fib(n): #wypisz ciąg Fibonacciego do n\n"
807+ "... \"\"\" Wypisz ciąg Fibonacciego do n.\"\"\" \n"
808+ "... a, b = 0, 1\n"
809+ "... while a < n:\n"
810+ "... print(a, end=' ')\n"
811+ "... a, b = b, a+b\n"
812+ "... print()\n"
813+ "...\n"
814+ ">>> # Teraz uruchom funkcję, którą właśnie zdefiniowaliśmy:\n"
815+ ">>> fib(2000)\n"
816+ "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597"
806817
807818msgid ""
808819"The keyword :keyword:`def` introduces a function *definition*. It must be "
@@ -888,6 +899,11 @@ msgid ""
888899">>> f(100)\n"
889900"0 1 1 2 3 5 8 13 21 34 55 89"
890901msgstr ""
902+ ">>> fib\n"
903+ "<function fib at 10042ed0>\n"
904+ ">>> f = fib\n"
905+ ">>> f(100)\n"
906+ "0 1 1 2 3 5 8 13 21 34 55 89"
891907
892908msgid ""
893909"Coming from other languages, you might object that ``fib`` is not a function "
@@ -911,6 +927,9 @@ msgid ""
911927">>> print(fib(0))\n"
912928"None"
913929msgstr ""
930+ ">>> fib(0)\n"
931+ ">>> print(fib(0))\n"
932+ "None"
914933
915934msgid ""
916935"It is simple to write a function that returns a list of the numbers of the "
@@ -933,6 +952,18 @@ msgid ""
933952">>> f100 # write the result\n"
934953"[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]"
935954msgstr ""
955+ ">>> def fib2(n): # zwróć ciąg Fibonacciego do n\n"
956+ "... \"\"\" Zwróć listę zawierającą ciąg Fibonacciego do n.\"\"\" \n"
957+ "... result = []\n"
958+ "... a, b = 0, 1\n"
959+ "... while a < n:\n"
960+ "... result.append(a) # zobacz poniżej\n"
961+ "... a, b = b, a+b\n"
962+ "... return result\n"
963+ "...\n"
964+ ">>> f100 = fib2(100) # uruchom to\n"
965+ ">>> f100 # wypisz wynik\n"
966+ "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]"
936967
937968msgid "This example, as usual, demonstrates some new Python features:"
938969msgstr "Ten przykład, jak zazwyczaj, prezentuje nowe cechy Pythona:"
@@ -1051,6 +1082,13 @@ msgid ""
10511082"i = 6\n"
10521083"f()"
10531084msgstr ""
1085+ "i = 5\n"
1086+ "\n"
1087+ "def f(arg=i):\n"
1088+ " print(arg)\n"
1089+ "\n"
1090+ "i = 6\n"
1091+ "f()"
10541092
10551093msgid "will print ``5``."
10561094msgstr "wyświetli ``5``."
@@ -1075,6 +1113,13 @@ msgid ""
10751113"print(f(2))\n"
10761114"print(f(3))"
10771115msgstr ""
1116+ "def f(a, L=[]):\n"
1117+ " L.append(a)\n"
1118+ " return L\n"
1119+ "\n"
1120+ "print(f(1))\n"
1121+ "print(f(2))\n"
1122+ "print(f(3))"
10781123
10791124msgid "This will print ::"
10801125msgstr "To wyświetli ::"
@@ -1084,6 +1129,9 @@ msgid ""
10841129"[1, 2]\n"
10851130"[1, 2, 3]"
10861131msgstr ""
1132+ "[1]\n"
1133+ "[1, 2]\n"
1134+ "[1, 2, 3]"
10871135
10881136msgid ""
10891137"If you don't want the default to be shared between subsequent calls, you can "
@@ -1099,6 +1147,11 @@ msgid ""
10991147" L.append(a)\n"
11001148" return L"
11011149msgstr ""
1150+ "def f(a, L=None):\n"
1151+ " if L is None:\n"
1152+ " L = []\n"
1153+ " L.append(a)\n"
1154+ " return L"
11021155
11031156msgid "Keyword Arguments"
11041157msgstr "Argumenty nazwane"
0 commit comments