diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index e0fee02..0b1f295 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -49,11 +49,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Vincent, who is 31 years old, and lives in 123 backstreet has 500.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, age, address, salary, expenses = input(\"Please enter your name, age, address, salary and expenses (separated by commas:','): \").split(',')\n", + "age = int(age)\n", + "salary = float(salary)\n", + "expenses = float(expenses)\n", + "remaining_salary = round((salary - expenses), 1)\n", + "\n", + "is_salary_good = True\n", + "if remaining_salary < 500:\n", + " is_salary_good = False\n", + "\n", + "print(f\"{name}, who is {age} years old, and lives in {address} has {remaining_salary} dollars left from her salary after expenses. It is {is_salary_good} that she has more than $500 left.\")" ] }, { @@ -85,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 19, "metadata": {}, "outputs": [], "source": [ @@ -104,15 +122,44 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "249\n", + "['some', 'say', 'the', 'world', 'will', 'end', 'in', 'firesome', 'say', 'in', 'icefrom', 'what', 'ive', 'tasted', 'of', 'desirei', 'hold', 'with', 'those', 'who', 'favor', 'firebut', 'if', 'it', 'had', 'to', 'perish', 'twicei', 'think', 'i', 'know', 'enough', 'of', 'hateto', 'say', 'that', 'for', 'destruction', 'iceis', 'also', 'greatand', 'would', 'sufficepython', 'is', 'awesome!']\n" + ] + } + ], "source": [ - "# Your code here\n" + "punctuation = [\".\",\";\",\",\",\"!\",\"?\",\":\",\"'\",\"...\",\"\\n\",\"’\"]\n", + "stripped_poem = \"\"\n", + "\n", + "for i in poem:\n", + " if i in punctuation:\n", + " continue\n", + " else:\n", + " stripped_poem += i.lower()\n", + "\n", + "new_poem = stripped_poem + \"python is awesome!\"\n", + "print(len(new_poem))\n", + "\n", + "poem_list = new_poem.split(\" \")\n", + "print(poem_list)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -126,7 +173,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.9" } }, "nbformat": 4,