{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lab 2 Notes" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " Volume in drive C is Windows\n", " Volume Serial Number is B899-AB94\n", "\n", " Directory of C:\\Users\\student\\Desktop\n", "\n", "10/02/2019 10:18 AM .\n", "10/02/2019 10:18 AM ..\n", "10/02/2019 10:12 AM .ipynb_checkpoints\n", "10/02/2019 10:11 AM 1,378 cat_in_hat_words.txt\n", "10/02/2019 10:18 AM 5,629 lab2_notes.ipynb\n", "05/13/2016 01:33 PM 210 MSDS Online.url\n", "08/01/2018 04:14 PM Safety Information\n", "10/02/2019 09:30 AM 72 Untitled.ipynb\n", "10/02/2019 09:32 AM 555 Untitled1.ipynb\n", "10/02/2019 10:05 AM 9,092 week2_string_operation_notes.ipynb\n", " 6 File(s) 16,936 bytes\n", " 4 Dir(s) 322,960,265,216 bytes free\n" ] } ], "source": [ "%ls" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['a', 'about', 'after', 'all', 'always', 'and', 'another', 'any', 'are', 'as', 'asked', 'at', 'away', 'back', 'bad', 'ball', 'be', 'bed', 'bent', 'bet', 'big', 'bit', 'bite', 'book', 'books', 'bow', 'box', 'bump', 'bumps', 'but', 'by', 'ca', 'cake', 'call', 'came', 'can', 'cat', 'cold', 'come', 'could', 'cup', 'day', 'dear', 'deep', 'did', 'dish', 'do', 'dots', 'down', 'fall', 'fan', 'fast', 'fear', 'fell', 'find', 'fish', 'fly', 'for', 'fox', 'from', 'fun', 'funny', 'game', 'games', 'gave', 'get', 'give', 'go', 'gone', 'good', 'got', 'gown', 'had', 'hall', 'hand', 'hands', 'has', 'hat', 'have', 'he', 'head', 'hear', 'her', 'here', 'high', 'him', 'his', 'hit', 'hold', 'home', 'hook', 'hop', 'hops', 'house', 'how', 'i', 'if', 'in', 'into', 'is', 'it', 'jump', 'jumps', 'kicks', 'kind', 'kinds', 'kite', 'kites', 'know', 'last', 'let', 'like', 'lit', 'litte', 'little', 'look', 'looked', 'lot', 'lots', 'made', 'make', 'man', 'mat', 'me', 'mess', 'milk', 'mind', 'mother', 'my', 'near', 'net', 'new', 'no', 'not', 'nothing', 'now', 'of', 'oh', 'on', 'one', 'our', 'out', 'pack', 'pat', 'pick', 'picked', 'pink', 'play', 'playthings', 'plop', 'pot', 'put', 'rake', 'ran', 'red', 'rid', 'run', 'sad', 'said', 'sally', 'sank', 'sat', 'saw', 'say', 'see', 'shake', 'shame', 'she', 'shine', 'ship', 'shook', 'should', 'show', 'shut', 'sit', 'so', 'some', 'something', 'stand', 'step', 'stop', 'string', 'strings', 'sun', 'sunny', 'tail', 'take', 'tall', 'tame', 'tell', 'that', 'the', 'their', 'them', 'then', 'there', 'these', 'they', 'thing', 'things', 'think', 'this', 'thoe', 'those', 'thump', 'thumps', 'tip', 'to', 'too', 'top', 'toy', 'trick', 'tricks', 'two', 'up', 'us', 'wall', 'want', 'was', 'way', 'we', 'well', 'went', 'were', 'wet', 'what', 'when', 'white', 'who', 'why', 'will', 'wish', 'with', 'wood', 'would', 'yes', 'yet', 'you', 'your']\n" ] } ], "source": [ "with open('cat_in_hat_words.txt', 'r') as f:\n", " words = [line.strip() for line in f.readlines()]\n", "print(words)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'a'" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "words[0]" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['a', 'about', 'after', 'all']" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "words[0:4]" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "239" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(words)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Hi Engineers!\n", "12345\n", "Teachers always say 'do your homework', at least that's what I've heard\n", "Ω or Omega\n" ] } ], "source": [ "salutation=\"Hi Engineers!\"\n", "# this line is a comment\n", "print(salutation)\n", "print(\"12345\") #printing numbers this way makes them a string of characters\n", "# printing text that contains a quotation and quotation marks\n", "print(\"Teachers always say 'do your homework', at least that's what I've heard\")\n", "# printing a unicode character\n", "print(\"\\u03a9 or Omega\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }