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
85 changes: 76 additions & 9 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,34 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Raquel, who is 30 years old, and lives in Libon has 900.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(\"Please, enter your name:\")\n",
"age = int(input(\"Please, enter your age:\"))\n",
"adress = input(\"Please, enter your adress:\")\n",
"salary = float(input(\"Please, enter your salary:\"))\n",
"expenses = float(input(\"Please, enter your expenses:\"))\n",
"\n",
"remaining_salary = salary - expenses\n",
"remaining_salary = round(remaining_salary,1)\n",
"\n",
"if remaining_salary >= 500:\n",
" is_salary_good = True\n",
"else:\n",
" is_salary_good = False\n",
"\n",
"\n",
"print(f\"{name}, who is {age} years old, and lives in {adress} has {remaining_salary} 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 +108,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -102,17 +125,61 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"some say the world will end in fire\n",
"some say in ice\n",
"from what i’ve tasted of desire\n",
"i hold with those who favor fire\n",
"but if it had to perish twice\n",
"i think i know enough of hate\n",
"to say that for destruction ice\n",
"is also great\n",
"and would suffice\n",
"some say the world will end in fire\n",
"some say in ice\n",
"from what i’ve tasted of desire\n",
"i hold with those who favor fire\n",
"but if it had to perish twice\n",
"i think i know enough of hate\n",
"to say that for destruction ice\n",
"is also great\n",
"and would suffice\n",
"python is awesome!\n",
"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"
"poem = poem.replace(\",\",\"\")\n",
"poem = poem.replace(\".\",\"\")\n",
"\n",
"poem_lower = poem.lower()\n",
"\n",
"print(poem_lower)\n",
"\n",
"new_poem = poem_lower + \"\"\"\n",
"python is awesome!\"\"\"\n",
"\n",
"print(new_poem)\n",
"\n",
"print(len(new_poem))\n",
"\n",
"poem_list = new_poem.split()\n",
"\n",
"print(poem_list)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +193,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.14.6"
}
},
"nbformat": 4,
Expand Down