DoneSomeWork

This commit is contained in:
2024-12-05 20:20:03 +01:00
parent 5f0f81a790
commit bcff76d934
3 changed files with 277 additions and 61 deletions

View File

@ -29,54 +29,154 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ennyiszer: 4.111111111111111 Ennyi a maradék: 3\n"
]
}
],
"source": [
"# Egy síkbeli pont távolsága az origótól\n"
"print('Ennyiszer: ' , 111//27 , 'Ennyi a maradék: ', 111%27)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"7.810249675906654\n"
]
}
],
"source": [
"# Egy síkbeli pont távolsága az origótól\n",
"import math\n",
"\n",
"x = 5\n",
"y = 6\n",
"\n",
"tavolsag = lambda a , b : math.sqrt(a**2 + b**2)\n",
"print(tavolsag(x,y))"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A kör kerülete: 31.41592653589793\n",
"A kör területe: 78.53981633974483\n"
]
}
],
"source": [
"# Egy adott sugarú kör területe és kerülete\n",
"r = 5\n",
"\n",
"kerulet = lambda r: 2*r*math.pi\n",
"terulet = lambda r: (r**2)*math.pi\n",
"\n",
"print(f\"A kör kerülete: {kerulet(r)}\")\n",
"print(f\"A kör területe: {terulet(r)}\")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ASCII of the letter: 65\n"
]
}
],
"source": [
"# Egy adott karakter ASCII kódja\n",
"\n",
"ch = 'A'\n",
"\n",
"print(\"ASCII of the letter:\",ord(ch))"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A(z) 'A' NEM egy kisbetűs karakter!\n"
]
}
],
"source": [
"# Egy adott karakter angol kisbetű-e?\n",
"\n",
"a = 'A'\n",
"\n",
"if a.lower() == a:\n",
" print(f\"A(z) '{a}' egy kisbetűs karakter!\")\n",
"else:\n",
" print(f\"A(z) '{a}' NEM egy kisbetűs karakter!\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6.4031242374328485\n"
]
}
],
"source": [
"# Egy adott sugarú kör területe és kerülete\n"
"# Egy komplex szám abszolút értéke\n",
"\n",
"komp = 5+4j\n",
"\n",
"print(abs(komp))"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(2.3877944046161983+0.8375930507808814j)\n"
]
}
],
"source": [
"# Egy adott karakter ASCII kódja\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Egy adott karakter angol kisbetű-e?\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Egy komplex szám abszolút értéke\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Négyzetgyök 2 értéke komplex szám(ok) segítségével meghatározva\n"
"# Négyzetgyök 2 értéke komplex szám(ok) segítségével meghatározva\n",
"import cmath\n",
"\n",
"komp = 5+4j\n",
"\n",
"print(cmath.sqrt(komp))\n"
]
},
{
@ -88,10 +188,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'complex'>\n",
"<class 'str'>\n",
"<class 'int'>\n",
"<class 'function'>\n"
]
}
],
"source": [
"print(type(komp))\n",
"print(type(a))\n",
"print(type(x))\n",
"print(type(kerulet))"
]
},
{
"cell_type": "markdown",
@ -102,10 +218,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6\n"
]
}
],
"source": [
"a = '6'\n",
"print(int(a))"
]
},
{
"cell_type": "markdown",
@ -116,10 +243,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"3\n",
"3\n",
"4\n"
]
}
],
"source": [
"print(1+1*2)\n",
"print(2*1+1)\n",
"print(2*(1+1))"
]
},
{
"cell_type": "markdown",
@ -134,7 +275,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@ -148,7 +289,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.13.0"
}
},
"nbformat": 4,

View File

@ -27,10 +27,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Térfogat: 120\n",
"Felszín: 148\n"
]
}
],
"source": [
"a = 4\n",
"b = 5\n",
"c = 6\n",
"\n",
"print(f\"Térfogat: {a*b*c}\" )\n",
"print(f\"Felszín: {2*(a*b + a*c + b*c)}\" )"
]
},
{
"cell_type": "markdown",
@ -43,10 +59,23 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"'b' nagyobb\n"
]
}
],
"source": [
"a = int(input(\"Első szám: \"))\n",
"b = int(input(\"Második szám: \"))\n",
"\n",
"print(\"'a' nagyobb\") if a > b else print(\"'b' nagyobb\")"
]
},
{
"cell_type": "markdown",
@ -65,10 +94,29 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6 12 \n",
" **\n",
" ****\n",
" ******\n",
" ********\n"
]
}
],
"source": [
"for i in range(a, b, 1):\n",
" if i % c == 0:\n",
" print(i, end=' ') \n",
"\n",
"for i in range(5):\n",
" print((5-i)* ' ' + '*'*i*2)"
]
},
{
"cell_type": "markdown",
@ -87,7 +135,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@ -101,7 +149,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.13.0"
}
},
"nbformat": 4,

View File

@ -34,10 +34,37 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{500: 1, 200: 2, 5: 1}\n",
"cba\n"
]
}
],
"source": [
"euro = (500, 200, 100, 50, 20, 10, 5, 2, 1)\n",
"\n",
"num = int(input(\"Adjon meg egy számot! \"))\n",
"ret = {}\n",
"for i in euro:\n",
" while num // i > 0:\n",
" if i not in ret.keys():\n",
" ret.update({i : 1})\n",
" else:\n",
" ret[i] += 1\n",
" num = num - i\n",
" #ret.append(i)\n",
"\n",
"print(ret)\n",
"\n",
"\n",
"print(\"abc\"[::-1])"
]
},
{
"cell_type": "markdown",
@ -51,7 +78,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@ -65,7 +92,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.13.0"
}
},
"nbformat": 4,