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
54 changes: 45 additions & 9 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Sarah Peterson, who is 50 years old, and lives in C/ Washinton, 15 has 1300.0 dollars left from her salary after expenses. It is True that she has more than $500 left.\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"\n",
"user_name = input(\"Enter your name: \")\n",
"user_age = int(input(\"Enter your age: \"))\n",
"user_address = input(\"Enter your address: \")\n",
"user_salary = float(input(\"Enter your salary: \"))\n",
"user_expenses = float(input(\"Enter your expenses: \"))\n",
"money_after_expenses = user_salary - user_expenses\n",
"is_salary_good = money_after_expenses >= 500\n",
"print(f'{user_name}, who is {user_age} years old, and lives in {user_address} has {money_after_expenses} dollars left from her salary after expenses. It is {is_salary_good} that she has more than $500 left.')\n",
"\n",
"\n"
]
},
{
Expand Down Expand Up @@ -85,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,17 +121,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 40,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"259\n",
"['some', 'say', 'the', 'world', 'will', 'end', 'in', 'fire', 'some', 'say', 'in', 'ice', 'from', 'what', 'i’ve', 'tasted', 'of', 'desire', 'i', 'hold', 'with', 'those', 'who', 'favor', 'fire', 'but', 'if', 'it', 'had', 'to', 'perish', 'twice', 'i', 'think', 'i', 'know', 'enough', 'of', 'hate', 'to', 'say', 'that', 'for', 'destruction', 'ice', 'is', 'also', 'great', 'and', 'would', 'suffice', 'python', 'is', 'awesome!']\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"\n",
"poem = \" \".join(poem.split()).lower()\n",
"poem = poem.replace(\",\", \"\")\n",
"poem = poem.replace(\".\", \"\")\n",
"poem = poem + \" python is awesome!\"\n",
"print(len(poem))\n",
"poem_list = poem.split()\n",
"print(poem_list)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +162,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down