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
66 changes: 57 additions & 9 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,48 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 19,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Bd, who is 12 years old, and lives in Wekl has $1000.0 left from her salary after expenses.\n",
"It is True that she has more than $500 left.\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"name = input(\"What is your name?: \").title() #request info from user and put it in a title form\n",
"age = int(input(\"How old are you?: \"))# age is casted from string to int\n",
"address = input(\"What is your address?: \").title()\n",
"salary = float(input(\"How much salary do you receive?: \"))# cast str type to float type\n",
"expenses = float(input(\"How much is your total expenses every month?: \"))\n",
"money_after_expenses = salary - expenses\n",
"\n",
"is_salary_good = money_after_expenses >= 500 # conditional statement\n",
"\n",
"print(f\"{name}, who is {age} years old, and lives in {address} has ${round(money_after_expenses, 1)} left from her salary after expenses.\")\n",
"print(f\"It is {is_salary_good} that she has more than $500 left.\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Bn, who is 5 years old, and lives in Gh has $1000.0 left from her salary after expenses. It is True that she has more than $500 left.\n"
]
}
],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -85,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,17 +137,30 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 49,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"276\n",
"['some', 'say', 'the', 'world', 'will', 'end', 'in', 'fire\\nsome', 'say', 'in', 'ice\\nfrom', 'what', 'ive', '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', 'sufficepython', 'is', 'awesome!', 'python', 'is', 'awesome!']\n"
]
}
],
"source": [
"# Your code here\n"
"poem = poem.replace(\".\", \"\").replace(\",\", \"\").replace(\"’\", \"\").lower() \n",
"new_poem = poem + \" 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 +174,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down