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
60 changes: 51 additions & 9 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,36 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Simbiat, who is 30 years old, and lives at Lisboa, has remaining salary of $700.00 left from her salary after expenses.\n",
"Your salary is good.\n"
]
}
],
"source": [
"# Your code here\n"
"name = input(\"Enter your name: \")\n",
"age_str = input(\"Enter your age: \")\n",
"address = input(\"Enter your address: \")\n",
"salary_str = input(\"Enter your salary: \")\n",
"expenses_str = input(\"Enter your expenses: \")\n",
"\n",
"age = int(age_str)\n",
"salary = float(salary_str)\n",
"expenses = float(expenses_str)\n",
"\n",
"remaining_salary = salary - expenses\n",
"if remaining_salary >= 500:\n",
" print(f\"{name}, who is {age} years old, and lives at {address}, has remaining salary of ${remaining_salary:.2f} left from her salary after expenses.\")\n",
"is_salary_good = remaining_salary >= 500\n",
"if is_salary_good:\n",
" print(\"Your salary is good.\")\n",
"\n"
]
},
{
Expand Down Expand Up @@ -85,7 +110,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,17 +127,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"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.\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",
"263\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"
"clean_poem = poem.replace(\"\\n\", \" \").lower()\n",
"print(clean_poem)\n",
"resulting_string = clean_poem + \"Python is awesome!\"\n",
"print(resulting_string)\n",
"print(len(resulting_string))\n",
"poem_list = resulting_string.split()\n",
"print(poem_list)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +168,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down