Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Interview Questions
- Goat Latin is a made-up language based off of English, sort of like Pig Latin.
- The rules of Goat Latin are as follows:
- 1. If a word begins with a consonant (i.e. not a vowel), remove the first
- letter and append it to the end, then add 'ma'.
- For example, the word 'goat' becomes 'oatgma'.
- 2. If a word begins with a vowel (a, e, i, o, or u), append 'ma' to the end of the word.
- For example, the word 'I' becomes 'Ima'.
- 3. Add one letter "a" to the end of each word per its word index in the
- sentence, starting with 1. That is, the first word gets "a" added to the
- end, the second word gets "aa" added to the end, the third word in the
- sentence gets "aaa" added to the end, and so on.
- Write a function that, given a string of words making up one sentence, returns
- that sentence in Goat Latin. For example:
- string_to_goat_latin('I speak Goat Latin')
- would return: 'Imaa peaksmaaa oatGmaaaa atinLmaaaaa'
- =========================================================
- You will be supplied with two data files in CSV format. The first file contains
- statistics about various dinosaurs. The second file contains additional data.
- Given the following formula,
- speed = ((STRIDE_LENGTH / LEG_LENGTH) - 1) * SQRT(LEG_LENGTH * g)
- Where g = 9.8 m/s^2 (gravitational constant)
- Write a program to read in the data files from disk, it must then print the names
- of only the bipedal dinosaurs from fastest to slowest. Do not print any other information.
- $ cat dataset1.csv
- NAME,LEG_LENGTH,DIET
- Hadrosaurus,1.2,herbivore
- Struthiomimus,0.92,omnivore
- Velociraptor,1.0,carnivore
- Triceratops,0.87,herbivore
- Euoplocephalus,1.6,herbivore
- Stegosaurus,1.40,herbivore
- Tyrannosaurus Rex,2.5,carnivore
- $ cat dataset2.csv
- NAME,STRIDE_LENGTH,STANCE
- Euoplocephalus,1.87,quadrupedal
- Stegosaurus,1.90,quadrupedal
- Tyrannosaurus Rex,5.76,bipedal
- Hadrosaurus,1.4,bipedal
- Deinonychus,1.21,bipedal
- Struthiomimus,1.34,bipedal
- Velociraptor,2.72,bipedal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement