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
70 changes: 62 additions & 8 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,41 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"Please insert your name: Julia\n",
"Please insert your age: 30\n",
"Please insert your address: R Lisbon\n",
"Please insert your salary: 600\n",
"Please insert your expenses: 200\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Julia, who is 30 years old, and lives in R Lisbon has 400.0 dollars left from her salary after expenses. It is False that she has more than $500 left.\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"name = input(\"Please insert your name: \")\n",
"age = input(\"Please insert your age: \")\n",
"address = input(\"Please insert your address: \")\n",
"salary = round(float(input(\"Please insert your salary: \")))\n",
"expenses = float(input(\"Please insert your expenses: \"))\n",
"remaining_salary = salary - expenses\n",
"if remaining_salary > 500:\n",
" is_salary_good = True\n",
"else:\n",
" is_salary_good = False\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 +115,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,12 +132,36 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 16,
"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",
"first_format_poem = poem.replace(\",\", \"\")\n",
"first_format_poem2 = first_format_poem.replace(\".\", \"\")\n",
"format_poem = first_format_poem2.lower()\n",
"poem_add = \"python is awesome!\"\n",
"new_poem = format_poem + \" \" + poem_add\n",
"print(len(new_poem))\n",
"poem_list = new_poem.split( )\n",
"print(poem_list)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -126,7 +180,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.13.5"
}
},
"nbformat": 4,
Expand Down