1
0
Fork 0

Popraw podstawy

This commit is contained in:
Tomasz Dwojak 2017-11-19 10:40:34 +01:00
parent 4f5cf71dd1
commit 43d3ba1d85
1 changed files with 150 additions and 34 deletions

View File

@ -12,7 +12,7 @@
"\n", "\n",
" \n", " \n",
"\n", "\n",
"## 13 maja 2017" "## 19 Listopada 2017"
] ]
}, },
{ {
@ -30,7 +30,19 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false, "slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"source": [
"print('Hello Python')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -43,7 +55,7 @@
"print(123456789 * 987654321)\n", "print(123456789 * 987654321)\n",
"print(10 ** 20)\n", "print(10 ** 20)\n",
"print(12 ** (3 + 4 *(567 % 8) / 9))\n", "print(12 ** (3 + 4 *(567 % 8) / 9))\n",
"print(\"PI\", \"jest prawie równe \", 3.1415)" "print(\"PI\", \"jest równe \", 3.1415)"
] ]
}, },
{ {
@ -55,23 +67,29 @@
}, },
"source": [ "source": [
"## Komentarze\n", "## Komentarze\n",
" * Komentarze w Pythonie zaczynają się od '#',\n", " * Komentarze nie są interpretowane.\n",
" * Komentarze nie są interpretowane." " * Komentarze w Pythonie zaczynają się od znaku '#'\n",
" * Istnieją komentarze wielolinijkowe tagowane potrójnym \", czyli \"\"\" \"\"\"\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"print(\"Ala ma kota.\") # A to jest komentarz\n", "print(\"Bardzo ważna wiadomość\") # A to jest komentarz\n",
"# print(\"Nie chcę być wydrukowanym\")" "\"\"\"\n",
"Komentarz\n",
"wielo-\n",
"linijkowy\n",
"\"\"\"\n",
"# print(\"Nie chcę być wydrukowanym\")\n",
"print(\"A teraz chcę\")"
] ]
}, },
{ {
@ -85,14 +103,13 @@
"## Zmienne\n", "## Zmienne\n",
" * case sensitive,\n", " * case sensitive,\n",
" * brak deklaracji typu,\n", " * brak deklaracji typu,\n",
" * do zmiennej można przypisać każdy obiekt" " * do zmiennej można pezypisać wszystko."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -105,14 +122,30 @@
"pi = 3.1415\n", "pi = 3.1415\n",
"imie_prowadzacego = 'Tomek'\n", "imie_prowadzacego = 'Tomek'\n",
"nazwisko_prowadzego = \"Dwojak\"\n", "nazwisko_prowadzego = \"Dwojak\"\n",
"czy_lubie_pythona = True # False " "czy_lubie_pythona = True # False \n",
"nic = None"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"source": [
"lucky_number = 7\n",
"lucky_number +=8\n",
"lucky_number = lucky_number / 3\n",
"print(lucky_number)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -144,7 +177,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
} }
@ -175,7 +207,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -190,7 +221,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -205,7 +235,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -231,7 +260,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -263,7 +291,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -293,7 +320,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -322,7 +348,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -337,7 +362,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -363,7 +387,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -392,7 +415,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -411,7 +433,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -437,7 +458,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -452,7 +472,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -490,7 +509,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -508,7 +526,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -536,7 +553,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -554,7 +570,6 @@
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": false,
"slideshow": { "slideshow": {
"slide_type": "fragment" "slide_type": "fragment"
} }
@ -566,14 +581,115 @@
"print(is_greater_than_5(500))" "print(is_greater_than_5(500))"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {
"collapsed": true,
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Łańcuchy znakowe"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"metadata": { "metadata": {
"collapsed": true "slideshow": {
"slide_type": "fragment"
}
}, },
"outputs": [], "outputs": [],
"source": [] "source": [
"napis = \"Wiadomość\"\n",
"print(napis)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": [
"for znak in napis:\n",
" print(znak, ord(znak))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": [
"if 'dom' in napis:\n",
" print(True)\n",
"else:\n",
" print(False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"outputs": [],
"source": [
"slowa = ['Bardzo' , 'ważna', 'wiadomość']\n",
"print(' '.join(slowa))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"source": [
"text = \"Bardzo ważna wiadomość\"\n",
"print(text.split(' '))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [],
"source": [
"text = \"Nie wszyscy lubią spacje na końcu linii. \"\n",
"print(text)\n",
"print(text.strip(' '))"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "slide"
}
},
"source": [
"# Pytania?"
]
} }
], ],
"metadata": { "metadata": {
@ -593,9 +709,9 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.5.2" "version": "3.6.3"
} }
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 0 "nbformat_minor": 1
} }