Add gitignore
This commit is contained in:
parent
0a345e2101
commit
9765333eae
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# wiki files
|
||||||
|
Python2017.wiki/*
|
||||||
|
*/.ipynb_checkpoints/*
|
||||||
|
.ropeproject
|
||||||
|
*/.ropeproject
|
@ -49,22 +49,34 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 9,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "slide"
|
"slide_type": "slide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"2\n",
|
||||||
|
"[1, 2, 3, 1, 2, 3]\n",
|
||||||
|
"123\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"def dwojak(x): x *= 2\n",
|
"def dwojak(x): \n",
|
||||||
|
" x *= 2\n",
|
||||||
|
" return x\n",
|
||||||
" \n",
|
" \n",
|
||||||
"l = [1, 2, 3]\n",
|
"l = [1, 2, 3]\n",
|
||||||
"s = \"123\"\n",
|
"s = \"123\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"dwojak(l)\n",
|
"dwojak(l)\n",
|
||||||
"dwojak(s)\n",
|
"dwojak(s)\n",
|
||||||
"\n",
|
"print(dwojak(1))\n",
|
||||||
"print(l)\n",
|
"print(l)\n",
|
||||||
"print(s)"
|
"print(s)"
|
||||||
]
|
]
|
||||||
@ -104,16 +116,28 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 11,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "slide"
|
"slide_type": "slide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[1, 2, 3, 1, 2, 3]\n",
|
||||||
|
"F: [1, 2, 3, 1, 2, 3]\n",
|
||||||
|
"[1, 2, 3]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"def dwojak1(x): x *= 2\n",
|
"def dwojak1(x): x *= 2\n",
|
||||||
"def dwojak2(x): x = x * 2\n",
|
"def dwojak2(x): \n",
|
||||||
|
" x = x * 2\n",
|
||||||
|
" print(\"F:\", x)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"l = [1,2, 3]\n",
|
"l = [1,2, 3]\n",
|
||||||
"dwojak1(l)\n",
|
"dwojak1(l)\n",
|
||||||
@ -126,29 +150,47 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 17,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "slide"
|
"slide_type": "slide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[1, 2, 3]\n",
|
||||||
|
"[1, 2, 3, 4]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"l = [1, 2, 3]\n",
|
"l = [1, 2, 3]\n",
|
||||||
"e = l\n",
|
"e = l[:]\n",
|
||||||
"e.append(4)\n",
|
"e.append(4)\n",
|
||||||
"print(l)"
|
"print(l)\n",
|
||||||
|
"print(e)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 19,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "slide"
|
"slide_type": "slide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"[[1], [1], [1]]\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"e = []\n",
|
"e = []\n",
|
||||||
"f = [e for i in range(3)]\n",
|
"f = [e for i in range(3)]\n",
|
||||||
@ -172,18 +214,39 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 25,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "slide"
|
"slide_type": "slide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"(1, 'napis', [0])\n",
|
||||||
|
"3\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ename": "TypeError",
|
||||||
|
"evalue": "unhashable type: 'list'",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"\u001b[0;32m<ipython-input-25-2bd2fa17fbf5>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mt\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0mt\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
||||||
|
"\u001b[0;31mTypeError\u001b[0m: unhashable type: 'list'"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"t = (1, \"napis\", None)\n",
|
"t = (1, \"napis\", [])\n",
|
||||||
"elem = t[0]\n",
|
"t[-1].append(0)\n",
|
||||||
"print(t)\n",
|
"print(t)\n",
|
||||||
"print(len(t))"
|
"print(len(t))\n",
|
||||||
|
"print({t: None})"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -199,19 +262,29 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 36,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "fragment"
|
"slide_type": "fragment"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"15\n",
|
||||||
|
"a == 1\n",
|
||||||
|
"b == (3, 4)\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"def suma(*args):\n",
|
"def suma(*args):\n",
|
||||||
" return sum(args)\n",
|
" return sum(args)\n",
|
||||||
"print(suma(1,2,3,4,5))\n",
|
"print(suma(1,2,3,4,5))\n",
|
||||||
"\n",
|
"\n",
|
||||||
"def greet_me(**kwargs):\n",
|
"def greet_me(z=None,**kwargs):\n",
|
||||||
" if kwargs is not None:\n",
|
" if kwargs is not None:\n",
|
||||||
" for key, value in kwargs.items():\n",
|
" for key, value in kwargs.items():\n",
|
||||||
" print(\"%s == %s\" %(key,value))\n",
|
" print(\"%s == %s\" %(key,value))\n",
|
||||||
@ -231,16 +304,32 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 38,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "fragment"
|
"slide_type": "fragment"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"97\n",
|
||||||
|
"a\n",
|
||||||
|
"98\n",
|
||||||
|
"b\n",
|
||||||
|
"99\n",
|
||||||
|
"c\n",
|
||||||
|
"100\n",
|
||||||
|
"d\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"def alfaRange(x, y):\n",
|
"def alfaRange(x, y):\n",
|
||||||
" for i in range(ord(x), ord(y)):\n",
|
" for i in range(ord(x), ord(y)):\n",
|
||||||
|
" print(i)\n",
|
||||||
" yield chr(i)\n",
|
" yield chr(i)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"for c in alfaRange('a', 'e'):\n",
|
"for c in alfaRange('a', 'e'):\n",
|
||||||
@ -260,40 +349,74 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 45,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "fragment"
|
"slide_type": "fragment"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"W Paryżu najlepsze kasztany są na placu Pigalle\n",
|
||||||
|
"Zuzanna lubi je tylko jesienią.\n",
|
||||||
|
"\n",
|
||||||
|
">>\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"plik = open(\"haslo.txt\", 'r')\n",
|
"plik = open(\"haslo.txt\", 'r')\n",
|
||||||
"for linia in plik.readlines():\n",
|
"for linia in plik.readlines():\n",
|
||||||
" print(linia.strip())\n",
|
" print(linia.strip())\n",
|
||||||
"print(plik.read())\n",
|
"print(plik.read())\n",
|
||||||
|
"print(\">>\")\n",
|
||||||
"plik.close()"
|
"plik.close()"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 47,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "slide"
|
"slide_type": "slide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"W Paryżu najlepsze kasztany są na placu Pigalle\n",
|
||||||
|
"\n",
|
||||||
|
"Zuzanna lubi je tylko jesienią.\n",
|
||||||
|
"\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ename": "ValueError",
|
||||||
|
"evalue": "I/O operation on closed file.",
|
||||||
|
"output_type": "error",
|
||||||
|
"traceback": [
|
||||||
|
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
||||||
|
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
|
||||||
|
"\u001b[0;32m<ipython-input-47-f06513c1bbec>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mlinia\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mplik\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreadlines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlinia\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mplik\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
|
||||||
|
"\u001b[0;31mValueError\u001b[0m: I/O operation on closed file."
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"with open(\"haslo.txt\", 'r') as plik:\n",
|
"with open(\"haslo.txt\", 'r') as plik:\n",
|
||||||
" for linia in plik.readlines():\n",
|
" for linia in plik.readlines():\n",
|
||||||
" print(linia)\n",
|
" print(linia)\n",
|
||||||
"# print(plik.read())"
|
"print(plik.read())"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 48,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": true,
|
"collapsed": true,
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
@ -334,13 +457,22 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 49,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "fragment"
|
"slide_type": "fragment"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"posix\n",
|
||||||
|
"Nazwa uzytkownika: tomaszd\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import os\n",
|
"import os\n",
|
||||||
"print(os.name)\n",
|
"print(os.name)\n",
|
||||||
@ -351,13 +483,31 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 50,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "slide"
|
"slide_type": "slide"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"Counter({'o': 4, 'n': 4, 'a': 4, 'k': 3, 't': 3, 'y': 2, 'i': 2, 'c': 2, 'z': 2, 's': 1, 'p': 1, 'l': 1, 'ń': 1, 'w': 1, 'e': 1})\n"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"array([[ 1., 3., 4., 5.]], dtype=float32)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 50,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"from collections import *\n",
|
"from collections import *\n",
|
||||||
"print(Counter(\"konstantynopolitańczykowianeczka\"))\n",
|
"print(Counter(\"konstantynopolitańczykowianeczka\"))\n",
|
||||||
@ -394,13 +544,23 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 51,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"slideshow": {
|
"slideshow": {
|
||||||
"slide_type": "fragment"
|
"slide_type": "fragment"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"What's your name?\n",
|
||||||
|
"Tomasz\n",
|
||||||
|
"Welcome home, Tomasz.\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"name = input(\"What's your name?\\n\")\n",
|
"name = input(\"What's your name?\\n\")\n",
|
||||||
"print(\"Welcome home, {}.\".format(name))"
|
"print(\"Welcome home, {}.\".format(name))"
|
||||||
|
Loading…
Reference in New Issue
Block a user