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
68 changes: 59 additions & 9 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"vitor, who is 38 years old, and lives in schleemer, has 25.0 dollars left from their salary after expenses. It is False that they have more than $500 left.\n"
]
}
],
"source": [
"# Your code here\n"
"name = input(\"Enter your name: \")\n",
"age = int(input(\"Enter your age: \"))\n",
"address = input(\"Enter your address: \")\n",
"salary = float(input(\"Enter your monthly salary: \"))\n",
"expenses = float(input(\"Enter your monthly expenses: \"))\n",
"\n",
"remaining_salary = salary - expenses\n",
"\n",
"remaining_salary = round(remaining_salary, 1)\n",
"\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 their salary after expenses. It is {is_salary_good} that they have more than $500 left.\")\n",
"\n"
]
},
{
Expand Down Expand Up @@ -85,7 +107,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,17 +124,45 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Length of the new string: 259\n",
"['some', 'say', 'the', 'world', 'will', 'end', 'in', 'fire\\nsome', 'say', 'in', 'ice\\nfrom', 'what', 'i’ve', 'tasted', 'of', 'desire\\ni', 'hold', 'with', 'those', 'who', 'favor', 'fire\\nbut', 'if', 'it', 'had', 'to', 'perish', 'twice\\ni', 'think', 'i', 'know', 'enough', 'of', 'hate\\nto', 'say', 'that', 'for', 'destruction', 'ice\\nis', 'also', 'great\\nand', 'would', 'suffice', 'python', 'is', 'awesome!']\n"
]
}
],
"source": [
"# Your code here\n"
"punctuation = \".,!?;:'\\\"-–—()[]{}\"\n",
"\n",
"\n",
"poem_clean = poem\n",
"for char in punctuation:\n",
" poem_clean = poem_clean.replace(char, \"\")\n",
"\n",
"poem_clean = poem_clean.lower()\n",
"\n",
"\n",
"new_string = poem_clean + \" python is awesome!\"\n",
"\n",
"\n",
"print(\"Length of the new string:\", len(new_string))\n",
"\n",
"\n",
"poem_list = new_string.split(\" \")\n",
"\n",
"\n",
"print(poem_list)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +176,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down