{ "cells": [ { "cell_type": "markdown", "id": "76cc981d", "metadata": {}, "source": [ "# Wordle Master\n", "\n", "This notebook is meant ot teach you how to become a wordle master! In it we will run through various exercises in python to analyze words and do some simple analysis of the wordle dictionary and english words in general.\n", "\n", "The wordle dataset is from here: https://www.kaggle.com/bcruise/wordle-valid-words\n", "\n", "Let's get started with some python review!\n", "\n", "Strings are values which are wrapped in quotation marks, either single or double. Strings also act as lists - you can treat them as a sequence of individual characters which is really useful for analysis." ] }, { "cell_type": "code", "execution_count": 1, "id": "ae40bab8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "wordle\n" ] } ], "source": [ "# Here is a variable called word which contains the string \"wordle\"\n", "name = \"wordle\"\n", "\n", "# You can print any value in python with the print() function\n", "print(name)" ] }, { "cell_type": "code", "execution_count": 2, "id": "8accc4ba", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "w\n" ] } ], "source": [ "# Since strings are sequences we can index them to get individual letters.\n", "# Remember that indexing starts at 0\n", "first_letter = name[0]\n", "\n", "print(first_letter)" ] }, { "cell_type": "markdown", "id": "18ac848a", "metadata": {}, "source": [ "### Exercise 1: Try and print the last letter of name using indexing" ] }, { "cell_type": "code", "execution_count": null, "id": "45e2c86e", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "id": "e9ad82b7", "metadata": {}, "source": [ "## Indexing review\n", "\n", "Great job with that exercise! Indexing is a valuable tool when working with sequences and we'll be relying on it heavily in the rest of the module. " ] } ], "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.10.1" } }, "nbformat": 4, "nbformat_minor": 5 }