

import math
import random






def 					__lowercase      (     _A						,    _A = False			)     ->						int:
      if deriv:
            return value * (1 - value)
      return 1 / (1 + math.exp(-value			))


# Initial Value
UpperCAmelCase__ :     Union[str, Any]				    =    0.02






def 					__lowercase      (     _A						,    _A			)     ->						List[Any]:
      SCREAMING_SNAKE_CASE :      Union[str, Any]       =   float(2 * (random.randint(1						,    100			)) - 1			)

      for _ in range(__lowerCAmelCase			):
            # Forward propagation
            SCREAMING_SNAKE_CASE :      int       =   sigmoid_function(INITIAL_VALUE * weight			)
            # How much did we miss?
            SCREAMING_SNAKE_CASE :      int       =   (expected / 100) - layer_a
            # Error delta
            SCREAMING_SNAKE_CASE :      Union[str, Any]       =   layer_1_error * sigmoid_function(__lowerCAmelCase						,    __lowerCAmelCase			)
            # Update weight
            weight += INITIAL_VALUE * layer_1_delta

      return layer_a * 100


if __name__ == "__main__":
  import doctest

  doctest.testmod()

  UpperCAmelCase__ :     Optional[int]				    =    int(input("""Expected value: """))
  UpperCAmelCase__ :     Dict				    =    int(input("""Number of propagations: """))
  print(forward_propagation(expected, number_propagations))







def 					__lowercase      (     _A			)     ->						str:
      SCREAMING_SNAKE_CASE :      Optional[Any]       =   """"""
      for ch in key:
            if ch == " " or ch not in key_no_dups and ch.isalpha():
                  key_no_dups += ch
      return key_no_dups






def 					__lowercase      (     _A			)     ->						dict[str, str]:
      SCREAMING_SNAKE_CASE :      int       =   [chr(i + 65			) for i in range(26			)]
      # Remove duplicate characters from key
      SCREAMING_SNAKE_CASE :      List[str]       =   remove_duplicates(key.upper()			)
      SCREAMING_SNAKE_CASE :      Dict       =   len(_A			)
      # First fill cipher with key characters
      SCREAMING_SNAKE_CASE :      int       =   {alphabet[i]: char for i, char in enumerate(_A			)}
      # Then map remaining characters in alphabet to
      # the alphabet from the beginning
      for i in range(len(_A			)						,    26			):
            SCREAMING_SNAKE_CASE :      List[Any]       =   alphabet[i - offset]
            # Ensure we are not mapping letters to letters previously mapped
            while char in key:
                  offset -= 1
                  SCREAMING_SNAKE_CASE :      str       =   alphabet[i - offset]
            SCREAMING_SNAKE_CASE :      List[Any]       =   char
      return cipher_alphabet






def 					__lowercase      (     _A						,    _A			)     ->						str:
      return "".join(cipher_map.get(_A						,    _A			) for ch in message.upper()			)






def 					__lowercase      (     _A						,    _A			)     ->						str:
      SCREAMING_SNAKE_CASE :      Optional[int]       =   {v: k for k, v in cipher_map.items()}
      return "".join(rev_cipher_map.get(_A						,    _A			) for ch in message.upper()			)






def 					__lowercase      (     )     ->						None:
      SCREAMING_SNAKE_CASE :      List[Any]       =   input("""Enter message to encode or decode: """			).strip()
      SCREAMING_SNAKE_CASE :      str       =   input("""Enter keyword: """			).strip()
      SCREAMING_SNAKE_CASE :      Dict       =   input("""Encipher or decipher? E/D:"""			).strip()[0].lower()
      try:
            SCREAMING_SNAKE_CASE :      int       =   {"""e""": encipher, """d""": decipher}[option]
      except KeyError:
            raise KeyError("""invalid input option"""			)
      SCREAMING_SNAKE_CASE :      Optional[int]       =   create_cipher_map(_A			)
      print(func(_A						,    _A			)			)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  main()




