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
80 changes: 72 additions & 8 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": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello Heràcles, who is 27 years old, and lives in Vic, has a remaining salary of 6000.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",
"name = input(\"What is your name? \")\n",
"age = int(input(\"What is your age? \"))\n",
"adress = input(\"What is your address? \")\n",
"salary = float(input(\"What is your salary? \"))\n",
"expenses = float(input(\"What are your expenses? \"))\n",
"\n",
"remaining_salary = round(salary - expenses, 1)\n",
"\n",
"is_salary_good = remaining_salary >= 500\n",
"\n",
"print(f\"Hello {name}, who is {age} years old, and lives in {adress}, has a remaining salary of {remaining_salary} dollars left from her salary after expenses. It is {is_salary_good} that she has more than $500 left.\")"
]
},
{
Expand Down Expand Up @@ -85,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,17 +121,62 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Your code here\n",
"cleaned_poem = poem.replace(\",\", \"\").replace(\".\", \"\").lower()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# Your code here\n"
"final_poem = cleaned_poem + \" Python is awesome!\""
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"259\n"
]
}
],
"source": [
"print(len(final_poem))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['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": [
"poem_list = final_poem.split()\n",
"print(poem_list)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": ".venv",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +190,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.14.3"
}
},
"nbformat": 4,
Expand Down