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
166 changes: 150 additions & 16 deletions cfu-data-types.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,39 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 17,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdin",
"output_type": "stream",
"text": [
"Enter your name: maria\n",
"Enter your age: 30\n",
"Enter your adress: Barcelona\n",
"Enter your salary: 1000.36\n",
"Enter your expenses: 653.25\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"maria , who is 30 years old, and lives in Barcelona has 347.11 dollars left from her salary after expenses. It is True that she has more than $500 left.\n"
]
}
],
"source": [
"# Your code here\n"
"# Your code here\n",
"name = input(\"Enter your name: \")\n",
"age = int(input(\"Enter your age: \"))\n",
"adress = input(\"Enter your adress: \")\n",
"salary = float(input(\"Enter your salary: \"))\n",
"expenses = float(input(\"Enter your expenses: \"))\n",
"money_after_expenses = round( salary - expenses, 2)\n",
"salary_up_500 = salary >= 500 \n",
"\n",
"print(f\"{name} , who is {age} years old, and lives in {adress} has {money_after_expenses} dollars left from her salary after expenses. It is {salary_up_500} that she has more than $500 left.\")"
]
},
{
Expand Down Expand Up @@ -85,29 +113,135 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 30,
"metadata": {},
"outputs": [],
"source": [
"poem = \"\"\"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.\"\"\""
"poem = \"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"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 31,
"metadata": {},
"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"
]
}
],
"source": [
"# Your code here\n",
"poem = poem.lower()\n",
"print(poem)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [],
"source": [
"poem = poem.replace(\",\",\" \")"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"poem = poem.replace(\".\",\" \")"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"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"
]
}
],
"source": [
"print(poem)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [],
"source": [
"# Your code here\n"
"poem_2 = \"python is awesome!\""
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"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 python is awesome!\n"
]
}
],
"source": [
"poem_final = poem + poem_2\n",
"print(poem_final)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"259\n"
]
}
],
"source": [
"print(len(poem_final))"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"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', 'python', 'is', 'awesome!']\n"
]
}
],
"source": [
"poem_list = poem_final.split(\" \")\n",
"print(poem_list)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -126,7 +260,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down