





'''simple docstring'''

from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
lowercase_         =			9.8_0_6_6_5





def lowerCamelCase						(					__lowerCamelCase			:   float ,	__lowerCamelCase			:   float   )						->None:

    # Ensure valid instance
    if not isinstance(__lowerCamelCase ,	(int, float)   ):
        raise TypeError("""Invalid velocity. Should be a positive number."""   )

    if not isinstance(__lowerCamelCase ,	(int, float)   ):
        raise TypeError("""Invalid angle. Range is 1-90 degrees."""   )

    # Ensure valid angle
    if angle > 90 or angle < 1:
        raise ValueError("""Invalid angle. Range is 1-90 degrees."""   )

    # Ensure valid velocity
    if init_velocity < 0:
        raise ValueError("""Invalid velocity. Should be a positive number."""   )





def lowerCamelCase						(					__lowerCamelCase			:   float ,	__lowerCamelCase			:   float   )						->float:
    check_args(__lowerCamelCase ,	__lowerCamelCase   )
    _SCREAMING_SNAKE_CASE     =      angle_to_radians(2 * angle   )
    return round(init_velocity**2 * sin(__lowerCamelCase   ) / g ,	2   )





def lowerCamelCase						(					__lowerCamelCase			:   float ,	__lowerCamelCase			:   float   )						->float:
    check_args(__lowerCamelCase ,	__lowerCamelCase   )
    _SCREAMING_SNAKE_CASE     =      angle_to_radians(__lowerCamelCase   )
    return round(init_velocity**2 * sin(__lowerCamelCase   ) ** 2 / (2 * g) ,	2   )





def lowerCamelCase						(					__lowerCamelCase			:   float ,	__lowerCamelCase			:   float   )						->float:
    check_args(__lowerCamelCase ,	__lowerCamelCase   )
    _SCREAMING_SNAKE_CASE     =      angle_to_radians(__lowerCamelCase   )
    return round(2 * init_velocity * sin(__lowerCamelCase   ) / g ,	2   )





def lowerCamelCase						(					)						->None:
    _SCREAMING_SNAKE_CASE    ,	_SCREAMING_SNAKE_CASE     =      25, 20
    assert horizontal_distance(__lowerCamelCase ,	__lowerCamelCase   ) == 40.97
    assert max_height(__lowerCamelCase ,	__lowerCamelCase   ) == 3.73
    assert total_time(__lowerCamelCase ,	__lowerCamelCase   ) == 1.74


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

      testmod()

      # Get input from user
      lowercase_         =			float(input("""Initial Velocity: """).strip())

      # Get input from user
      lowercase_         =			float(input("""angle: """).strip())

      # Print results
      print()
      print("""Results: """)
      print(f"""Horizontal Distance: {horizontal_distance(init_vel, angle)!s} [m]""")
      print(f"""Maximum Height: {max_height(init_vel, angle)!s} [m]""")
      print(f"""Total Time: {total_time(init_vel, angle)!s} [s]""")










'''simple docstring'''

import os
import sys
import time

from . import transposition_cipher as trans_cipher





def lowerCamelCase						(					)						->None:
    _SCREAMING_SNAKE_CASE     =      """Prehistoric Men.txt"""
    _SCREAMING_SNAKE_CASE     =      """Output.txt"""
    _SCREAMING_SNAKE_CASE     =      int(input("""Enter key: """   )   )
    _SCREAMING_SNAKE_CASE     =      input("""Encrypt/Decrypt [e/d]: """   )

    if not os.path.exists(__lowerCamelCase   ):
        print(F'File {input_file} does not exist. Quitting...'   )
        sys.exit()
    if os.path.exists(__lowerCamelCase   ):
        print(F'Overwrite {output_file}? [y/n]'   )
        _SCREAMING_SNAKE_CASE     =      input("""> """   )
        if not response.lower().startswith("""y"""   ):
            sys.exit()

    _SCREAMING_SNAKE_CASE     =      time.time()
    if mode.lower().startswith("""e"""   ):
        with open(__lowerCamelCase   ) as f:
            _SCREAMING_SNAKE_CASE     =      f.read()
        _SCREAMING_SNAKE_CASE     =      trans_cipher.encrypt_message(__lowerCamelCase ,	__lowerCamelCase   )
    elif mode.lower().startswith("""d"""   ):
        with open(__lowerCamelCase   ) as f:
            _SCREAMING_SNAKE_CASE     =      f.read()
        _SCREAMING_SNAKE_CASE     =      trans_cipher.decrypt_message(__lowerCamelCase ,	__lowerCamelCase   )

    with open(__lowerCamelCase ,	"""w"""   ) as output_obj:
        output_obj.write(__lowerCamelCase   )

    _SCREAMING_SNAKE_CASE     =      round(time.time() - start_time ,	2   )
    print(("""Done (""", total_time, """seconds )""")   )


if __name__ == "__main__":
      main()



