






import socket

def        UpperCAmelCase__		(						):
			__a						:  int									=     socket.socket(socket.AF_INET   ,  socket.SOCK_STREAM				)
			__a						:  Optional[Any]									=     socket.gethostname()
			__a						:  int									=     1_2_3_1_2

			sock.connect((host, port)				)
			sock.send(b'Hello server!'				)

			with open('Received_file'   ,  'wb'				) as out_file:
						print('File opened'				)
						print('Receiving data...'				)
						while True:
									__a						:  List[Any]									=     sock.recv(1_0_2_4				)
									if not data:
												break
									out_file.write(lowerCamelCase_				)

			print('Successfully received the file'				)
			sock.close()
			print('Connection closed'				)


if __name__ == "__main__":
							main()












from collections.abc import Callable





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE							,     _SCREAMING_SNAKE_CASE				)							-> float:




    """simple docstring"""




    _A     =							a
    _A     =							b
    if function(_SCREAMING_SNAKE_CASE				) == 0:  # one of the a or b is a root for the function
        return a
    elif function(_SCREAMING_SNAKE_CASE				) == 0:
        return b
    elif (
        function(_SCREAMING_SNAKE_CASE				) * function(_SCREAMING_SNAKE_CASE				) > 0
    ):  # if none of these are root and they are both positive or negative,
        # then this algorithm can't find the root
        raise ValueError('could not find root in given interval.'				)
    else:
        _A     =							start + (end - start) / 2.0
        while abs(start - mid				) > 10**-7:  # until precisely equals to 10^-7
            if function(_SCREAMING_SNAKE_CASE				) == 0:
                return mid
            elif function(_SCREAMING_SNAKE_CASE				) * function(_SCREAMING_SNAKE_CASE				) < 0:
                _A     =							mid
            else:
                _A     =							mid
            _A     =							start + (end - start) / 2.0
        return mid





def 				__lowerCAmelCase(       _SCREAMING_SNAKE_CASE				)							-> float:




    """simple docstring"""




    return x**3 - 2 * x - 5


if __name__ == "__main__":
 print(bisection(f, 1, 1_000))

 import doctest

 doctest.testmod()





