'''simple docstring'''





class  lowerCAmelCase__   :



  '''simple docstring'''






  def __init__(self  : int	, lowerCAmelCase_  : Dict    )   ->       Optional[Any]:
        snake_case_						       =							data
        snake_case_						       =							None
        snake_case_						       =							None


  def __str__(self  : Dict    )   ->       Dict:
        return f'''{self.data}'''



class  lowerCAmelCase__   :



  '''simple docstring'''






  def __init__(self  : str    )   ->       Optional[Any]:
        snake_case_						       =							None
        snake_case_						       =							None

  def __iter__(self  : Optional[int]    )   ->       Optional[int]:
        snake_case_						       =							self.head
        while node:
              yield node.data
              snake_case_						       =							node.next

  def __str__(self  : Optional[int]    )   ->       Optional[Any]:
        return "->".join([str(lowerCAmelCase_    ) for item in self]    )

  def __len__(self  : Optional[int]    )   ->       List[Any]:
        return sum(1 for _ in self    )

  def 		_lowerCamelCase	(self  : List[Any]	, lowerCAmelCase_  : Tuple    )   ->       Union[str, Any]:
        self.insert_at_nth(0	, lowerCAmelCase_    )

  def 		_lowerCamelCase	(self  : Dict	, lowerCAmelCase_  : List[str]    )   ->       str:
        self.insert_at_nth(len(self    )	, lowerCAmelCase_    )

  def 		_lowerCamelCase	(self  : Union[str, Any]	, lowerCAmelCase_  : int	, lowerCAmelCase_  : Optional[int]    )   ->       Optional[int]:
        snake_case_						       =							len(self    )

        if not 0 <= index <= length:
              raise IndexError("list index out of range"    )
        snake_case_						       =							Node(lowerCAmelCase_    )
        if self.head is None:
              snake_case_						       =							new_node
        elif index == 0:
              snake_case_						       =							new_node
              snake_case_						       =							self.head
              snake_case_						       =							new_node
        elif index == length:
              snake_case_						       =							new_node
              snake_case_						       =							self.tail
              snake_case_						       =							new_node
        else:
              snake_case_						       =							self.head
              for _ in range(0	, lowerCAmelCase_    ):
                    snake_case_						       =							temp.next
              snake_case_						       =							new_node
              snake_case_						       =							temp.previous
              snake_case_						       =							temp
              snake_case_						       =							new_node

  def 		_lowerCamelCase	(self  : Tuple    )   ->       Optional[Any]:
        return self.delete_at_nth(0    )

  def 		_lowerCamelCase	(self  : Dict    )   ->       Any:
        return self.delete_at_nth(len(self    ) - 1    )

  def 		_lowerCamelCase	(self  : Optional[int]	, lowerCAmelCase_  : int    )   ->       Union[str, Any]:
        snake_case_						       =							len(self    )

        if not 0 <= index <= length - 1:
              raise IndexError("list index out of range"    )
        snake_case_						       =							self.head  # default first node
        if length == 1:
              snake_case_						       =							None
        elif index == 0:
              snake_case_						       =							self.head.next
              snake_case_						       =							None
        elif index == length - 1:
              snake_case_						       =							self.tail
              snake_case_						       =							self.tail.previous
              snake_case_						       =							None
        else:
              snake_case_						       =							self.head
              for _ in range(0	, lowerCAmelCase_    ):
                    snake_case_						       =							temp.next
              snake_case_						       =							temp
              snake_case_						       =							temp.previous
              snake_case_						       =							temp.next
        return delete_node.data

  def 		_lowerCamelCase	(self  : Any	, lowerCAmelCase_  : List[Any]    )   ->       int:
        snake_case_						       =							self.head

        while current.data != data:  # Find the position to delete
              if current.next:
                    snake_case_						       =							current.next
              else:  # We have reached the end an no value matches
                    raise ValueError("No data matching given value"    )

        if current == self.head:
              self.delete_head()

        elif current == self.tail:
              self.delete_tail()

        else:  # Before: 1 <--> 2(current) <--> 3
              snake_case_						       =							current.next  # 1 --> 3
              snake_case_						       =							current.previous  # 1 <--> 3
        return data


  def 		_lowerCamelCase	(self  : str    )   ->       List[str]:
        return len(self    ) == 0

def   snake_case_       (							):
      snake_case_						       =							DoublyLinkedList()
      assert linked_list.is_empty() is True
      assert str(lowerCAmelCase__			) == ""

      try:
            linked_list.delete_head()
            raise AssertionError  # This should not happen.
      except IndexError:
            assert True  # This should happen.

      try:
            linked_list.delete_tail()
            raise AssertionError  # This should not happen.
      except IndexError:
            assert True  # This should happen.

      for i in range(10			):
            assert len(lowerCAmelCase__			) == i
            linked_list.insert_at_nth(lowerCAmelCase__ ,					i + 1			)
      assert str(lowerCAmelCase__			) == "->".join(str(lowerCAmelCase__			) for i in range(1 ,					11			)			)

      linked_list.insert_at_head(0			)
      linked_list.insert_at_tail(11			)
      assert str(lowerCAmelCase__			) == "->".join(str(lowerCAmelCase__			) for i in range(0 ,					12			)			)

      assert linked_list.delete_head() == 0
      assert linked_list.delete_at_nth(9			) == 10
      assert linked_list.delete_tail() == 11
      assert len(lowerCAmelCase__			) == 9
      assert str(lowerCAmelCase__			) == "->".join(str(lowerCAmelCase__			) for i in range(1 ,					10			)			)


if __name__ == "__main__":
     from doctest import testmod

     testmod()



'''simple docstring'''





from __future__ import annotations

import random



class  lowerCAmelCase__   :



  '''simple docstring'''






  _UpperCamelCase						= 6

  def __init__(self  : List[Any]    )   ->       Optional[Any]:
        snake_case_						       =							list(range(1	, Dice.NUM_SIDES + 1    )    )


  def 		_lowerCamelCase	(self  : Optional[int]    )   ->       int:
        return random.choice(self.sides    )

def   snake_case_       (							_a     :							int ,					_a     :							int = 2			):
      snake_case_						       =							[Dice() for i in range(_a			)]
      snake_case_						       =							[0] * (len(_a			) * Dice.NUM_SIDES + 1)
      for _ in range(_a			):
            count_of_sum[sum(dice.roll() for dice in dices			)] += 1
      snake_case_						       =							[round((count * 100) / num_throws ,					2			) for count in count_of_sum]
      return probability[num_dice:]  # remove probability of sums that never appear


if __name__ == "__main__":
     import doctest

     doctest.testmod()

