Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. Interview Questions
  2.  
  3. Goat Latin is a made-up language based off of English, sort of like Pig Latin.
  4.  
  5. The rules of Goat Latin are as follows:
  6. 1. If a word begins with a consonant (i.e. not a vowel), remove the first
  7. letter and append it to the end, then add 'ma'.
  8. For example, the word 'goat' becomes 'oatgma'.
  9. 2. If a word begins with a vowel (a, e, i, o, or u), append 'ma' to the end of the word.
  10. For example, the word 'I' becomes 'Ima'.
  11. 3. Add one letter "a" to the end of each word per its word index in the
  12. sentence, starting with 1. That is, the first word gets "a" added to the
  13. end, the second word gets "aa" added to the end, the third word in the
  14. sentence gets "aaa" added to the end, and so on.
  15.  
  16. Write a function that, given a string of words making up one sentence, returns
  17. that sentence in Goat Latin. For example:
  18.  
  19. string_to_goat_latin('I speak Goat Latin')
  20.  
  21. would return: 'Imaa peaksmaaa oatGmaaaa atinLmaaaaa'
  22.  
  23.  
  24. =========================================================
  25. You will be supplied with two data files in CSV format. The first file contains
  26. statistics about various dinosaurs. The second file contains additional data.
  27.  
  28. Given the following formula,
  29.  
  30. speed = ((STRIDE_LENGTH / LEG_LENGTH) - 1) * SQRT(LEG_LENGTH * g)
  31. Where g = 9.8 m/s^2 (gravitational constant)
  32.  
  33. Write a program to read in the data files from disk, it must then print the names
  34. of only the bipedal dinosaurs from fastest to slowest. Do not print any other information.
  35.  
  36. $ cat dataset1.csv
  37. NAME,LEG_LENGTH,DIET
  38. Hadrosaurus,1.2,herbivore
  39. Struthiomimus,0.92,omnivore
  40. Velociraptor,1.0,carnivore
  41. Triceratops,0.87,herbivore
  42. Euoplocephalus,1.6,herbivore
  43. Stegosaurus,1.40,herbivore
  44. Tyrannosaurus Rex,2.5,carnivore
  45.  
  46. $ cat dataset2.csv
  47. NAME,STRIDE_LENGTH,STANCE
  48. Euoplocephalus,1.87,quadrupedal
  49. Stegosaurus,1.90,quadrupedal
  50. Tyrannosaurus Rex,5.76,bipedal
  51. Hadrosaurus,1.4,bipedal
  52. Deinonychus,1.21,bipedal
  53. Struthiomimus,1.34,bipedal
  54. Velociraptor,2.72,bipedal
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement