Search code, repositories, users, issues, pull requests...

Provide feedback.

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly.

To see all available qualifiers, see our documentation .

  • Notifications

CECS 475 lab assignment 3

TannerLow/Lab-Assignment-3

Name already in use.

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more about the CLI .

  • Open with GitHub Desktop
  • Download ZIP

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Lab-assignment-3, contributors 2.

LAB ASSIGNMENT 3

sqlite3 3.37.2

Embed on website

  • Toggle navigation

lab assignment 3

  • Portfolio Profile
  • Lab Assignment #1
  • Lab Assignment #2

Lab Assignment #3

  • Lab Assignment #4
  • Lab Assignment #5
  • Lab Assignment #6
  • Lab Assignment #7
  • Lab Assignment #8
  • Internships
  • Achievements

Description In this assignment, I will follow the steps on how to build a Pig Latin translator from Codecademy’s Python section. Pig Latin is a pseudo-language that is used by English-speakers who wants to disguise their words from non-Pig Latin speakers. The rule is to take the first consonant of an English word, move it to the end of the word and use the suffixes ‘ay’. If the word begins with a vowel, add ‘way’ at the end. For example, Pig becomes igpay, banana becomes ananabay, and aardvark becomes aardvarkway. Below are the instructions I followed in Codecademy.

Break It Down 1. Ask the user to input a word in English. 2. make sure the user entered a valid word. 3. Convert the word from English to Pig Latin. 4. Display the translation result.

Break It Down

Ahoy! (Or Should I Say Ahoyay!) Print the phrase “Pig Latin” on the screen.

Ahoy! (or Should I Say Ahoyay!)

Input! 1. On line 4, use raw_input(“enter a word:”) to ask the user to enter a word. Save the results of raw_input() in a variable called original. 2. Click save & submit code. 3. Type a word in the console window and press enter.

Input!

Check Yourself! 1. Add an if statement that checks that len(original) is greater than zero. Don’t forget the : at the end of the if statement! 2. If the string actually has some characters in it, print the user’s word. 3. Otherwise (i.e. an else: statement), print “empty”.

Check Yourself!

Check Yourself… Some More Use and to add a second condition to your if statement. In addition to your existing check that the string contains characters, you should also use .isalpha() to make sure that it only contains letters. Don’t forget to keep the colon at the end of the if statement.

Check Yourself Some More

Pop Quiz! Take some time to test your current code. Try some inputs that should pass and that should fail. Enter some strings that contain non-alphabetical characters and an empty string.

Pop Quiz!

Ay B C Create a variable named pyg and set it equal to the suffix ‘ay’.

Ay B C

Word Up Inside your if statement: 1. Create a new variable called word that holds the .lower()-case conversion of original. 2. Create a new variable called first that holds word[0], the first letter of word.

Word Up

Move It On Back On a new line after where you created the first variable: Create a new variable called new_word and set it equal to the concatenation of word, first, and pyg.

Move it on Back

Ending Up Set new_word equal to the slice from the first index all the way to the end of new_word. Use [1:len(new_word)] to do this.

Ending Up

Testing, Testing, Is This Thing On?

Testing, Testing, is This Thing On

CODE pyg = ‘ay’ original = raw_input(‘Enter a word: ‘) word = original.lower() first = word[0] new_word = word + first + pyg new_word = new_word[1:len(new_word)] if len(original) > 0 and original.isalpha(): print new_word else: print ’empty’

  • Write a brief paragraph to introduce yourself to your visitors and explain what they will find on this site. Be sure to add more developed content to your About Me page. (Edit this paragraph in Dashboard > Widgets > Text)
  • Search for:

Learning Blog Archives

Recent posts, the openlab at city tech: a place to learn, work, and share.

The OpenLab is an open-source, digital platform designed to support teaching and learning at City Tech (New York City College of Technology), and to promote student and faculty engagement in the intellectual and social life of the college community.

New York City College of Technology

New York City College of Technology | City University of New York

Accessibility

Our goal is to make the OpenLab accessible for all users.

Learn more about accessibility on the OpenLab

Creative Commons

  • - Attribution
  • - NonCommercial
  • - ShareAlike

Creative Commons

© New York City College of Technology | City University of New York

IMAGES

  1. Kin 220 assignemnt 3

    lab assignment 3

  2. Solved EXPERIMENT 3 CAPACITORS Pre Lab Assignment 1.

    lab assignment 3

  3. Lab assignment 1

    lab assignment 3

  4. LAB 3 assignment

    lab assignment 3

  5. Solved MATH 0600: Lab Assignment #3 Instructions: You are

    lab assignment 3

  6. Lab Assignment 1.pdf

    lab assignment 3

VIDEO

  1. Lab4 Class I

  2. Fundamentals of Programming

  3. BIOL 107 Lab Assignment

  4. Lab#9 Practice Select Statement

  5. Tutorial 3 Assignment 3 Lectures 6 & 7

  6. ONI BIO LAB ASSIGNMENT

COMMENTS

  1. What Are Some Possible Sources of Errors in the Lab?

    Some possible sources of errors in the lab includes instrumental or observational errors. Environmental errors can also occur inside the lab. Instrumental errors can occur when the tools are not functioning exactly as they should be.

  2. How Long Do Chocolate Labs Live?

    Like all Labrador Retrievers, chocolate labs have an average life expectancy of 10 to 12 years. Black is the most popular color for these dogs. Chocolate brown is second, followed by yellow labs.

  3. Selling Made Easy: Steps to Successfully Sell Your Used Lab Equipment

    Are you looking to upgrade your lab equipment or simply get rid of the old ones that are no longer in use? Selling your used lab equipment can be a great way to recoup some of your investment and make space for new and improved tools.

  4. Lab Assignment 3 Tue 9e265f00232162 fe3e3183bd020c2941

    will be deducted for each week delay after the first due date and time. ... this assignment if you don't

  5. 1 Lab Assignment 3 1. What level of...

    A negative correlation between the two variables is demonstrated as those with lower educational attainment believes that women are not suitable for politics

  6. Lab Assignment 3

    Lab Assignment 3 - Introduction To Data Communication Systems Lab · 1. Create file called “index. · 2. Using sftp, copy the file to your public_html directory

  7. Lab Assignment 3 Given Triangle struct

    Given Triangle struct (in files Triangle.h and Triangle.c), complete main() to read and set the base and height data members of triangle1 and of

  8. Lab Assignment 3-2 Shell Scripts...

    Write a script called MakeFunction which creates a function named: CreateDir.The function when called should accept a new directory name as a command line

  9. CECS 475 lab assignment 3

    CECS 475 lab assignment 3. Contribute to TannerLow/Lab-Assignment-3 development by creating an account on GitHub.

  10. LAB ASSIGNMENT 3 (SQL)

    LAB ASSIGNMENT 3 · Copy link · Download · Share on Facebook · Share on Twitter · Share on Reddit · Embed on website.

  11. Lab Assignment #3

    Lab Assignment #3. PIG LATIN. Description In this assignment, I will follow the steps on how to build a Pig Latin translator from Codecademy's Python section

  12. Lab Assignment 3

    1); each time you draw the world, you'll overlay all the shapes on the list. Each shape will contain a posn (a two-number structure) that

  13. Lab Assignment

    operations. ... Select Any Doubly Linked List Operation! ... Select Any Doubly Linked List

  14. Solved Lab Assignment 3 You need to implement a unique

    Lab Assignment 3 You need to implement a unique function (append_new_list) that appends a new list to the end of a list of lists. This function