Skip to Main Content
Impractical Python Projects
book

Impractical Python Projects

by Lee Vaughan
November 2018
Beginner content levelBeginner
424 pages
11h 43m
English
No Starch Press
Content preview from Impractical Python Projects

PRACTICE PROJECT SOLUTIONS

image

This appendix provides the solutions to the practice projects in each chapter. Digital versions are available on the book’s website at https://www.nostarch.com/impracticalpython/.

Chapter 1: Silly Name Generator

Pig Latin

pig_Latin_practice.py

"""Turn a word into its Pig Latin equivalent."""import sysVOWELS = 'aeiouy'while True:    word = input("Type a word and get its Pig Latin translation: ")    if word[0] in VOWELS:        pig_Latin = word + 'way'    else:        pig_Latin = word[1:] + word[0] + 'ay'    print()    print("{}".format(pig_Latin), file=sys.stderr)    try_again = input("\n\nTry again? (Press Enter else ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tiny Python Projects

Tiny Python Projects

Ken Youens-Clark

Publisher Resources

ISBN: 9781492069454