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
44 changes: 39 additions & 5 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@
"metadata": {},
"outputs": [],
"source": [
"# Your code here\n"
"name = input(\"Please input your name:\")\n",
"age = int(input(\"Please input your age:\"))\n",
"address = input(\"Please input your address:\")\n",
"salary = float(input(\"Please input your salary:\"))\n",
"expenses = float(input(\"Please input your expenses:\"))\n",
"remaining = round(salary - expenses,1)\n",
"\n",
"is_salary_good = str(remaining >= 500).lower()\n",
"\n",
"print(f\"{name}, who is {age} years old, and lives in {address} has {remaining} dollars left from her salary after expenses. It is {is_salary_good} that she has more than $500 left.\")"
]
},
{
Expand Down Expand Up @@ -85,7 +94,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -106,13 +115,38 @@
"metadata": {},
"outputs": [],
"source": [
"# Your code here\n"
"import re\n",
"\n",
"cleaned_poem = re.sub(r'[^\\w\\s]','',poem).replace('\\n',' ')\n",
"\n",
"concated_string = cleaned_poem + ' Python is asesome!'\n",
"\n",
"concated_string"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(len(concated_string))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"concated_string_list = concated_string.split(' ')\n",
"concated_string_list"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "py310",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +160,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.18"
}
},
"nbformat": 4,
Expand Down