Meta | E5 | US | Phone screen
Given a string containing parenthesis (), braces {}, brackets [], and angle brackets <>, write a function to return True if that string is balanced, and False otherwise.
A string is considered balanced if each opening bracket is followed by a matching closing bracket at the same nesting level, and each closing bracket has been preceded by a matching opening bracket also at the same nesting level.
Some examples:
"some string" => True
"[abc(def)gh{i}j]" => True
"[abcdef" => False (no closing bracket)
"abcd(egf))" => False (extra closing parenthesis)
")abcd((egf" => False (extra closing parenthesis at the start)
"(abcd[)]efgh" => False (closing parenthesis is not nested at the same level as the opening one)
<hr> You have been given two data files in CSV format, each of which contains specific statistics about various dinosaurs.Using this formula to calculate the speeds of the dinosaurs found in the two files: speed = ((STRIDE_LENGTH / LEG_LENGTH) - 1) * SQRT(LEG_LENGTH * 9.8)
... write a program that will:
The data files that you are given appear as follows:
$ 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