Skip to content

Instantly share code, notes, and snippets.

@kylebgorman
Created September 9, 2022 21:05
Show Gist options
  • Save kylebgorman/dd4e280ea6847cf1710877a28e7cbc31 to your computer and use it in GitHub Desktop.
Save kylebgorman/dd4e280ea6847cf1710877a28e7cbc31 to your computer and use it in GitHub Desktop.
Methods I HW1 solution
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"id": "f623dda5",
"metadata": {},
"source": [
"# HW1 solution"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3eef08dd",
"metadata": {},
"outputs": [],
"source": [
"# Here, you can optionally omit the parentheses;\n",
"# Python will still know what you mean.\n",
"name = (\"Kyle\", \"Gorman\")\n",
"github_username = \"kylebgorman\""
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "6b684605",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"113.09723999999999"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"area = 3.14159 * 6 * 6 # or ... `* 6 ** 2`\n",
"area"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "5ad871ca",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['aa', 'am', 'om', 'so']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# These are all spoken in Ethopia.\n",
"lang_codes = [\n",
" \"aa\", # Afar.\n",
" \"am\", # Amharic.\n",
" \"om\", # Oromo.\n",
" \"so\", # Somali.\n",
"]\n",
"lang_codes"
]
},
{
"cell_type": "markdown",
"id": "3320b995",
"metadata": {},
"source": [
"I forgot what my GitHub username is so I had to look it up. I also had to look up some of the language codes."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment