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
81 changes: 72 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": [
"Teresa, who is 36 years old, and lives in lisboa has 700.0 dollars left from her salary after expenses. It is True 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(\"What is your address? \")\n",
"salary = float(input(\"What is your salary? \"))\n",
"expenses = float(input(\"How much are your expenses? \"))\n",
"\n",
"remaining_salary = round(salary - expenses, 1)\n",
"\n",
"is_salary_good = remaining_salary >= 500\n",
"\n",
"print(\n",
" f\"{name}, who is {age} years old, and lives in {address} \"\n",
" f\"has {remaining_salary} dollars left from her salary after expenses. \"\n",
" f\"It is {is_salary_good} that she has 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,58 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"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"
"# Your code here\n",
"import string\n",
"\n",
"poem_clean = poem.translate(str.maketrans(\"\", \"\", string.punctuation)).lower()\n",
"\n",
"new_string = poem_clean + \" python is awesome!\"\n",
"\n",
"print(len(new_string))\n",
"\n",
"poem_list = new_string.split(\" \")\n",
"\n",
"print(poem_list)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +189,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.14.6"
}
},
"nbformat": 4,
Expand Down