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
57 changes: 49 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": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Rita, who is 41 years old, and lives in Alhandra, Portugal has 93.42 dollars left from her salary after expenses. It is False that she has more than $500 left.\n"
]
}
],
"source": [
"# Your code here\n"
"name = input(\"What is your name? \")\n",
"age = int(input(\"How old are you? \"))\n",
"address = input(\"Where do you live? \")\n",
"salary = float(input(\"What is your salary? \"))\n",
"expenses = float(input(\"What are your monthly expenses? \"))\n",
"\n",
"How_much_money_left = salary - expenses\n",
"remaining_salary = round(How_much_money_left, 2)\n",
"\n",
"is_salary_good = remaining_salary >= 500\n",
"\n",
"print(f\"{name}, who is {age} years old, and lives in {address} has {remaining_salary} dollars left from her salary after expenses. It is {is_salary_good} that she has more than $500 left.\")\n"
]
},
{
Expand Down Expand Up @@ -85,7 +104,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,17 +121,39 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# Your code here\n"
"import re\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"257\n",
"['some', 'say', 'the', 'world', 'will', 'end', 'in', 'fire', 'some', 'say', 'in', 'ice', 'from', 'what', 'ive', '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": [
"# Without punctuation, in lowercase and with \"Python is awesome\"\n",
"new_poem = re.sub(r'[^\\w\\s]', '', poem).lower() + \" \" +\"Python is awesome\"\n",
"print(len(new_poem))\n",
"poem_list = new_poem.split()\n",
"print(poem_list)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +167,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.13.9"
}
},
"nbformat": 4,
Expand Down