Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 60 additions & 7 deletions cfu-data-types.ipynb → data-types-extra.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,31 @@
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Nice, your remain money is 761.5€\n"
]
}
],
"source": [
"# Your code here\n"
"name= input(\"Enter your name:\")\n",
"age=int(input(\"Enter your age:\"))\n",
"address= input(\"Enter your adress\")\n",
"salary=float(input(\"Enter your salary:\"))\n",
"expenses=float(input(\"Enter your expenses:\"))\n",
"salary_round=round(salary,1)\n",
"expenses_round=round(expenses,1)\n",
"remain=salary_round-expenses_round\n",
"if remain <500:\n",
" print(f\"{name}, who is {age} years olld, and livesin {address} has {remain}€ ledt from her salary after expenses. {name} need to save money, the remain is less than 500€\")\n",
"elif remain> 500:\n",
" print(f\"{name}, who is {age} years olld, and livesin {address} has {remain}€ ledt from her salary after expenses. {name} is good, the remain is more than 500€\")\n",
"else:\n",
" print (f\"{name}, who is {age} years olld, and livesin {address} has {remain}€ ledt from her salary after expenses. {name} the remain is equal to 500€\")\n",
" \n"
]
},
{
Expand Down Expand Up @@ -85,9 +107,28 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<class 'str'>\n",
"some say the world will end in fire\n",
"some say in ice\n",
"from what i’ve tasted of desire\n",
"i hold with those who favor fire\n",
"but if it had to perish twice\n",
"i think i know enough of hate\n",
"to say that for destruction ice\n",
"is also great\n",
"and would suffice\n",
"240\n",
"<class 'list'>\n"
]
}
],
"source": [
"poem = \"\"\"Some say the world will end in fire,\n",
"Some say in ice.\n",
Expand All @@ -97,7 +138,19 @@
"I think I know enough of hate\n",
"To say that for destruction ice\n",
"Is also great\n",
"And would suffice.\"\"\""
"And would suffice.\"\"\"\n",
"new= poem.lower()\n",
"def remove_punctuation(input_string):\n",
" result = input_string\n",
" for char in new:\n",
" result = result.replace(',', '')\n",
" result=result.replace('.','')\n",
" return result\n",
"cleaned_text = remove_punctuation(new)\n",
"print(type(new))\n",
"print (cleaned_text)\n",
"print(len(cleaned_text))\n",
"poem_list=cleaned_text.split()\n"
]
},
{
Expand All @@ -112,7 +165,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +179,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down