diff --git a/cfu-data-types.ipynb b/cfu-data-types.ipynb index e0fee02..0740a42 100644 --- a/cfu-data-types.ipynb +++ b/cfu-data-types.ipynb @@ -49,11 +49,46 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Greg, who is 30 years old, and lives in Jaco has 38362.0 dollars left from their salary after expenses. It is True that they have more than $500 left.\n" + ] + } + ], "source": [ - "# Your code here\n" + "name = input(\"The user's name is: \")\n", + "age = int(input(\"The user's age is: \"))\n", + "address = input(\"The user's address is: \")\n", + "gender = input(\"The user's gender is: \")\n", + "salary = float(input(\"The user's salary is: \"))\n", + "expenses = float(input(\"The user's expenses are: \"))\n", + "\n", + "if gender == \"male\":\n", + " pronoun1 = \"he\"\n", + " pronoun2 = \"him\"\n", + "elif gender == \"female\":\n", + " pronoun1 = \"she\"\n", + " pronoun2 = \"her\"\n", + "else:\n", + " pronoun1 = \"they\"\n", + " pronoun2 = \"their\"\n", + "\n", + "remaining_salary = round(salary - expenses, 1)\n", + "\n", + "if remaining_salary >= 500:\n", + " is_salary_good = True\n", + "else:\n", + " is_salary_good = False\n", + "\n", + "if pronoun1 == \"they\":\n", + " print(f\"{name}, who is {age} years old, and lives in {address} has {remaining_salary} dollars left from {pronoun2} salary after expenses. It is {is_salary_good} that {pronoun1} have more than $500 left.\")\n", + "else:\n", + " print(f\"{name}, who is {age} years old, and lives in {address} has {remaining_salary} dollars left from {pronoun2} salary after expenses. It is {is_salary_good} that {pronoun1} has more than $500 left.\")" ] }, { @@ -85,7 +120,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "metadata": {}, "outputs": [], "source": [ @@ -102,17 +137,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "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" + "poemstring = poem.replace(\".\",\"\").replace(\",\",\"\").lower()\n", + "newString = poemstring + \" python is awesome!\"\n", + "print(len(newString))\n", + "poem_list = newString.split()\n", + "print(poem_list)" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -126,7 +174,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.9" } }, "nbformat": 4,