Skip to content

Instantly share code, notes, and snippets.

@mccurcio
Created February 24, 2022 17:26
Show Gist options
  • Save mccurcio/1c5e223df88150be95135da519b94945 to your computer and use it in GitHub Desktop.
Save mccurcio/1c5e223df88150be95135da519b94945 to your computer and use it in GitHub Desktop.
Using List Indicators for Python
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": false
},
"id": "a7a5321e",
"cell_type": "code",
"source": "# This example is one way to link lists by using an index.\n# Using dictionaries should be considered when using indexed lists.\n\nnumber = [1, 2, 3]\nname = [\"Matt\", \"Sue\", \"Rich\"]\n\nind_sue = name.index(\"Sue\")\nind_sue",
"execution_count": 2,
"outputs": [
{
"data": {
"text/plain": "1"
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
]
},
{
"metadata": {
"trusted": false
},
"id": "d943c769",
"cell_type": "code",
"source": "number[ind_sue]",
"execution_count": 4,
"outputs": [
{
"data": {
"text/plain": "2"
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
]
}
],
"metadata": {
"gist": {
"id": "",
"data": {
"description": "Using List Indicators for Python",
"public": true
}
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3 (ipykernel)",
"language": "python"
},
"language_info": {
"name": "python",
"version": "3.8.12",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment