Last active
April 27, 2021 03:27
-
-
Save pbeens/cdc71eb9f0922fc78b40ccb1a0f78eb6 to your computer and use it in GitHub Desktop.
Word Challenges Template (Colab - Python).ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "Word Challenges Template (Colab - Python).ipynb", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/pbeens/cdc71eb9f0922fc78b40ccb1a0f78eb6/read-in-words-from-gist.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "0z3FZN7R_AkS" | |
}, | |
"source": [ | |
"# this retreives the file from a gist and saves it locally\n", | |
"!wget /resources/data/words.txt 'https://gist.githubusercontent.com/pbeens/274ccc9a9b4819c20e21a47072d146d1/raw/dc6200ee8e29c3d3d58af8fce06981b689e743c3/1000-top-words.txt'\n", | |
"\n", | |
"# this assigns the file to the variable 'file'\n", | |
"file = '/content/1000-top-words.txt'" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "CrIWbYmaD7A0" | |
}, | |
"source": [ | |
"# open file and create list\n", | |
"with open(file) as f:\n", | |
" words = f.read().split()\n", | |
"\n", | |
"# print the first 10 words\n", | |
"print(words[:10])" | |
], | |
"execution_count": null, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "ezIKKoQtShaG" | |
}, | |
"source": [ | |
"# Your solution goes here!\n" | |
], | |
"execution_count": null, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment