
from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset
class       _lowerCAmelCase  (		__magic_name__							):

 """simple docstring"""

 def      __lowerCAmelCase  (						self			:			Tuple   ):






      """simple docstring"""



      return [
          {"col_1": 3, "col_2": "a"},
          {"col_1": 2, "col_2": "b"},
          {"col_1": 1, "col_2": "c"},
          {"col_1": 0, "col_2": "d"},
      ]

 def      __lowerCAmelCase  (						self			:			Union[str, Any]   ):






      """simple docstring"""



      UpperCamelCase						    =					{'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
      return Dataset.from_dict(SCREAMING_SNAKE_CASE__   )

 def      __lowerCAmelCase  (						self			:			Tuple   ):






      """simple docstring"""



      UpperCamelCase						    =					self._create_example_records()
      UpperCamelCase						    =					Dataset.from_list(SCREAMING_SNAKE_CASE__   )
      self.assertListEqual(dset.column_names					, ['col_1', 'col_2']   )
      for i, r in enumerate(SCREAMING_SNAKE_CASE__   ):
           self.assertDictEqual(SCREAMING_SNAKE_CASE__					, example_records[i]   )

 def      __lowerCAmelCase  (						self			:			Optional[int]   ):






      """simple docstring"""



      UpperCamelCase						    =					self._create_example_records()
      UpperCamelCase						    =					Dataset.from_list(SCREAMING_SNAKE_CASE__   )
      UpperCamelCase						    =					Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}   )
      self.assertEqual(dset.info					, dset_from_dict.info   )

 def      __lowerCAmelCase  (						self			:			Union[str, Any]   ):  # checks what happens with missing columns






      """simple docstring"""



      UpperCamelCase						    =					[{'col_1': 1}, {'col_2': 'x'}]
      UpperCamelCase						    =					Dataset.from_list(SCREAMING_SNAKE_CASE__   )
      self.assertDictEqual(dset[0]					, {'col_1': 1}   )
      self.assertDictEqual(dset[1]					, {'col_1': None}   )  # NB: first record is used for columns

 def      __lowerCAmelCase  (						self			:			Optional[Any]   ):  # checks if the type can be inferred from the second record






      """simple docstring"""



      UpperCamelCase						    =					[{'col_1': []}, {'col_1': [1, 2]}]
      UpperCamelCase						    =					Dataset.from_list(SCREAMING_SNAKE_CASE__   )
      self.assertEqual(dset.info.features['col_1']					, Sequence(Value('int64'   )   )   )






 def      __lowerCAmelCase  (						self			:			Tuple   ):






      """simple docstring"""



      UpperCamelCase						    =					Dataset.from_list([]   )
      self.assertEqual(len(SCREAMING_SNAKE_CASE__   )					, 0   )
      self.assertListEqual(dset.column_names					, []   )




from decimal import Decimal, getcontext
from math import ceil, factorial

def  __lowerCamelCase					( _lowercase			)       ->      str:

     if not isinstance(_lowercase						,     _lowercase			):
          raise TypeError('Undefined for non-integers'			)
     elif precision < 1:
          raise ValueError('Undefined for non-natural numbers'			)

     UpperCamelCase						    =					precision
     UpperCamelCase						    =					ceil(precision / 14			)
     UpperCamelCase						    =					426880 * Decimal(10005			).sqrt()
     UpperCamelCase						    =					1
     UpperCamelCase						    =					13591409
     UpperCamelCase						    =					Decimal(_lowercase			)
     for k in range(1						,     _lowercase			):
          UpperCamelCase						    =					factorial(6 * k			) // (factorial(3 * k			) * factorial(_lowercase			) ** 3)
          linear_term += 545140134
          exponential_term *= -262537412640768000
          partial_sum += Decimal(multinomial_term * linear_term			) / exponential_term
     return str(constant_term / partial_sum			)[:-1]


if __name__ == "__main__":
 _snake_case      = 50
 print(F"The first {n} digits of pi is: {pi(n)}")


