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
116 changes: 113 additions & 3 deletions conditionals.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
"metadata": {},
"outputs": [],
"source": [
"trojans = [\"Priam\", \"Hector\", \"Paris\", \"Aeneas\", \"Cassandra\", \"Hecuba\", \"Andromache\"]\n",
"introjans = [\"Priam\", \"Hector\", \"Paris\", \"Aeneas\", \"Cassandra\", \"Hecuba\", \"Andromache\"]\n",
"\n",
"if \"Achilles\" in trojans:\n",
" print(\"Whoa, Achilles, what are you doing there!?\")\n",
Expand Down Expand Up @@ -356,11 +356,121 @@
"5. Collect all of the dialogue spoken by Socrates in a single string (recall multiline strings with `\"\"\"`). Do likewise for Phaedrus.\n",
"6. Use `len()` and a comparison operator to confirm that Socrates speaks more than Phaedrus."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"names = \"Socrates\", \"Phaedrus\", \"Theuth\", \"Thamus\"\n",
"mortals = \"Socrates\", \"Phaedrus\"\n",
"gods = \"Theuth\", \"Thamus\"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(mortals)\n",
"len(gods)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Socrates is a mortal!\n",
"Phaedrus is a mortal!\n",
"Theuth is a god!\n",
"Thamus is a god!\n"
]
}
],
"source": [
"for name in names:\n",
" if name in gods:\n",
" print(name + \" is a god!\")\n",
" if name in mortals:\n",
" print(name + \" is a mortal!\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"equal length\n"
]
}
],
"source": [
"if len(mortals) == len(gods):\n",
" print(\"equal length\")\n",
"else: \n",
" print(\"not equal length\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Socrates spoke more\n"
]
}
],
"source": [
"socrates_text = \"\"\"Well then, I heard that at Naucratis, in Egypt, there was some one of the ancient gods, who also has a sacred bird which they call “Ibis” — but the name of this divinity is Theuth. He was the first to discover arithmetic [arithmon] and calculation [logismon], geometry and astronomy, even backgammon and dice-playing, and especially letters.\n",
"\n",
"Now at that time the king of all Egypt was Thamus in the great city of the upper region, which the Greeks call “Egyptian Thebes” — and they call the god Ammon. And Theuth came to his palace to show him his skills [tas technas], and he said it was necessary to distribute them among the other Egyptians — but Thamus asked what the use [ōphelian] of each skill was. And while Theuth went through them, Thamus said whether each one seemed fine or not to him, censuring some and praising others.\n",
"\n",
"It is said, on the one hand, that Thamus said many such things on both sides [praise and blame] about each skill [peri hekastēs technēs] when Theuth was explaining them — the account [logos] of them would take a while to go through. But when it came to letters, Theuth said, “This invention, O king, will make the Egyptians wiser and more capable of remembering: for I have discovered a drug [pharmakon] for memory and wisdom.”\n",
"\n",
"And Thamus replied, “O most-skilled [technikōtate] Theuth, one person can fashion elements of a skill [ta technēs], but it’s up to someone else to judge what share of blame and usefulness it has for those who are going to use it. And now you, since you are the father of letters, because of your partiality, say that they have a capability opposite to what they really do. For this [invention] will yield forgetfulness in the souls of those who have learned it, and negligence with regard to their memories. Because through their trust in writing — foreign markings from outside, rather than their own remembering from within themselves.\n",
"\n",
"“So you have not discovered a drug for memory but for reminding. And you furnish your learners with what seems like wisdom, not true wisdom. For they will become hearers-of-many-things [polyēkooi] without instruction, and they will seem to be much-learned [polygnōmones] to you, but they will for the most part be unlearned [agnōmones], and they will make difficult company, since they will have become wise-seemers instead of wise people.”\"\"\"\n",
"\n",
"\n",
"phaedrus_text = \"\"\"You’re talking nonsense — but tell me what you said that you heard. O Socrates, you easily make up stories [logous] about Egypt and anywhere you want.\"\"\"\n",
"\n",
"\n",
"if len(socrates_text) > len(phaedrus_text):\n",
" print(\"Socrates spoke more\")\n",
"if len(socrates_text) < len(phaedrus_text):\n",
" print(\"Phaedrus spoke more\")\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -374,7 +484,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.7"
"version": "3.12.1"
}
},
"nbformat": 4,
Expand Down