PracticeForExam

This commit is contained in:
2024-12-05 23:20:53 +01:00
parent bcff76d934
commit a1e0e21582
5 changed files with 240 additions and 34 deletions

View File

@ -45,10 +45,42 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The number of different letters in the string is: 24\n",
"Ez egy lottószám: 64\n",
"Ez egy lottószám: 1\n",
"Ez egy lottószám: 6\n",
"Ez egy lottószám: 15\n",
"Ez egy lottószám: 30\n",
"[2, 1, 3, 9, 5, 10, 8, 6, 4, 7]\n"
]
}
],
"source": [
"text = \"Tis is a string with several andeven some more text inside, so we can decide how many different letters are used in it!\"\n",
"\n",
"print(f\"The number of different letters in the string is: {len(set(text))}\")\n",
"\n",
"import random\n",
"\n",
"lotto = set()\n",
"while len(lotto) < 5:\n",
" lotto.add(random.randint(1, 90))\n",
"\n",
"print('\\n'.join(['Ez egy lottószám: '+ str(i) for i in lotto]))\n",
"\n",
"\n",
"#veletlen sorrend:\n",
"numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n",
"random.shuffle(numbers)\n",
"print(numbers)\n"
]
},
{
"cell_type": "markdown",
@ -61,7 +93,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
@ -75,7 +107,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
"version": "3.12.3"
}
},
"nbformat": 4,