Last active
October 7, 2023 22:59
-
-
Save FinanceData/39c4c8864174f2eb7bd298b28e044e73 to your computer and use it in GitHub Desktop.
Chapter_06_PygLatin
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
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"source": [ | |
"# Chapter 06 PygLatin\n", | |
"<img align=\"left\" src=\"https://i.imgur.com/lnc0qMV.png\" />" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": true, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"# 01 Break It Down\n", | |
"\n", | |
"#there is nothing in this lesson\n", | |
"pass" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Welcome to the English to Pig Latin translator!\n" | |
] | |
} | |
], | |
"source": [ | |
"# 02 Ahoy or Should I Say Ahoyay\n", | |
"\n", | |
"print (\"Welcome to the English to Pig Latin translator!\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Welcome to the English to Pig Latin translator!\n", | |
"What's your name?plusjune\n" | |
] | |
} | |
], | |
"source": [ | |
"# 03 Input\n", | |
"\n", | |
"print (\"Welcome to the English to Pig Latin translator!\")\n", | |
"original = input(\"What's your name?\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Welcome to the English to Pig Latin translator!\n", | |
"What's your name?\n", | |
"empty\n" | |
] | |
} | |
], | |
"source": [ | |
"# 04 Check Yourself\n", | |
"\n", | |
"print (\"Welcome to the English to Pig Latin translator!\")\n", | |
"original = input(\"What's your name?\")\n", | |
"if len(original) != 0:\n", | |
" print (original)\n", | |
"else:\n", | |
" print (\"empty\")\n", | |
" \n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Welcome to the English to Pig Latin translator!\n", | |
"What's your name?plusjune\n", | |
"plusjune\n" | |
] | |
} | |
], | |
"source": [ | |
"# 05 Check Yourself Some More\n", | |
"\n", | |
"print (\"Welcome to the English to Pig Latin translator!\")\n", | |
"original = input(\"What's your name?\")\n", | |
"if len(original) != 0 and original.isalpha():\n", | |
" print (original)\n", | |
"else:\n", | |
" print (\"empty\")\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Welcome to the English to Pig Latin translator!\n", | |
"What's your name?plusjune\n", | |
"plusjune\n" | |
] | |
} | |
], | |
"source": [ | |
"# 06 Pop Quiz\n", | |
"\n", | |
"print (\"Welcome to the English to Pig Latin translator!\")\n", | |
"original = input(\"What's your name?\")\n", | |
"if len(original) != 0 and original.isalpha():\n", | |
" print (original)\n", | |
"else:\n", | |
" print (\"empty\")\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": { | |
"collapsed": true, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [], | |
"source": [ | |
"# 07 Ay B C\n", | |
"\n", | |
"pyg = \"ay\"" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 14, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Enter a word:hello\n", | |
"hello\n" | |
] | |
} | |
], | |
"source": [ | |
"# 08 Word Up\n", | |
"\n", | |
"pyg = 'ay'\n", | |
"\n", | |
"original = input('Enter a word:')\n", | |
"\n", | |
"if len(original) > 0 and original.isalpha():\n", | |
" word = original.lower()\n", | |
" first = word[0]\n", | |
" print (word)\n", | |
"else:\n", | |
" print ('empty')\n", | |
" \n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 15, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Enter a word:apple\n", | |
"vowel\n" | |
] | |
} | |
], | |
"source": [ | |
"# 09 E-I-E-I-O\n", | |
"\n", | |
"pyg = 'ay'\n", | |
"\n", | |
"original = input('Enter a word:')\n", | |
"\n", | |
"if len(original) > 0 and original.isalpha():\n", | |
" word = original.lower()\n", | |
" first = word[0]\n", | |
" if first == \"a\" or first == \"e\" or first == \"i\" or first == \"o\" or first == \"u\":\n", | |
" print (\"vowel\")\n", | |
" else:\n", | |
" print (\"consonant\")\n", | |
"else:\n", | |
" print ('empty')\n", | |
" \n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 16, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Enter a word:apple\n", | |
"appleay\n" | |
] | |
} | |
], | |
"source": [ | |
"# 10 I would Like to Buy a Vowel\n", | |
"\n", | |
"pyg = 'ay'\n", | |
"\n", | |
"original = input('Enter a word:')\n", | |
"\n", | |
"if len(original) > 0 and original.isalpha():\n", | |
" word = original.lower()\n", | |
" first = word[0]\n", | |
" if first == \"a\" or first == \"e\" or first == \"i\" or first == \"o\" or first == \"u\":\n", | |
" new_word = original + pyg\n", | |
" print (new_word)\n", | |
" else:\n", | |
" print (\"consonant\")\n", | |
"else:\n", | |
" print ('empty')\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Enter a word:apple\n", | |
"appleay\n" | |
] | |
} | |
], | |
"source": [ | |
"# 11 Almost Oneday\n", | |
"\n", | |
"pyg = 'ay'\n", | |
"\n", | |
"original = input('Enter a word:')\n", | |
"\n", | |
"if len(original) > 0 and original.isalpha():\n", | |
" word = original.lower()\n", | |
" first = word[0]\n", | |
" if first == \"a\" or first == \"e\" or first == \"i\" or first == \"o\" or first == \"u\":\n", | |
" new_word = word + pyg\n", | |
" print (new_word)\n", | |
" else:\n", | |
" new_word = word[1:len(original)] + first + \"ay\"\n", | |
" print (new_word)\n", | |
"else:\n", | |
" print ('empty')\n", | |
" " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": { | |
"collapsed": false, | |
"slideshow": { | |
"slide_type": "slide" | |
} | |
}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Enter a word:apple\n", | |
"appleay\n" | |
] | |
} | |
], | |
"source": [ | |
"# 12 Testing Testing is This Thing On\n", | |
"\n", | |
"pyg = 'ay'\n", | |
"\n", | |
"original = input('Enter a word:')\n", | |
"\n", | |
"if len(original) > 0 and original.isalpha():\n", | |
" word = original.lower()\n", | |
" first = word[0]\n", | |
" if first == \"a\" or first == \"e\" or first == \"i\" or first == \"o\" or first == \"u\":\n", | |
" new_word = word + pyg\n", | |
" print (new_word)\n", | |
" else:\n", | |
" new_word = word[1:len(original)] + first + \"ay\"\n", | |
" print (new_word)\n", | |
"else:\n", | |
" print ('empty')" | |
] | |
} | |
], | |
"metadata": { | |
"celltoolbar": "Slideshow", | |
"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.5.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment