



"""simple docstring"""





def 	UpperCAmelCase     (		A	:						List[str]       ):

		'''simple docstring'''


		_UpperCAmelCase							 =		[]
		_UpperCAmelCase							 =		[]
		_UpperCAmelCase							 =		{
		    '^': 3,
		    '*': 2,
		    '/': 2,
		    '%': 2,
		    '+': 1,
		    '-': 1,
		}  # Priority of each operator
		_UpperCAmelCase							 =		len(A       ) if (len(A       ) > 7) else 7

		# Print table header for output
		print(
		    'Symbol'.center(8       )     ,				'Stack'.center(A       )     ,				'Postfix'.center(A       )     ,				sep=' | '     ,				)
		print('-' * (print_width * 3 + 7)       )

		for x in infix:
				if x.isalpha() or x.isdigit():
						post_fix.append(A       )  # if x is Alphabet / Digit, add it to Postfix
				elif x == "(":
						stack.append(A       )  # if x is "(" push to Stack
				elif x == ")":  # if x is ")" pop stack until "(" is encountered
						while stack[-1] != "(":
								post_fix.append(stack.pop()       )  # Pop stack & add the content to Postfix
						stack.pop()
				else:
						if len(A       ) == 0:
								stack.append(A       )  # If stack is empty, push x to stack
						else:  # while priority of x is not > priority of element in the stack
								while len(A       ) > 0 and priority[x] <= priority[stack[-1]]:
										post_fix.append(stack.pop()       )  # pop stack & add to Postfix
								stack.append(A       )  # push x to stack

				print(
				    x.center(8       )     ,				(''.join(A       )).ljust(A       )     ,				(''.join(A       )).ljust(A       )     ,				sep=' | '     ,				)  # Output in tabular format

		while len(A       ) > 0:  # while stack is not empty
				post_fix.append(stack.pop()       )  # pop stack & add to Postfix
				print(
				    ' '.center(8       )     ,				(''.join(A       )).ljust(A       )     ,				(''.join(A       )).ljust(A       )     ,				sep=' | '     ,				)  # Output in tabular format

		return "".join(A       )  # return Postfix as str




def 	UpperCAmelCase     (		A	:						str       ):

		'''simple docstring'''


		_UpperCAmelCase							 =		list(infix[::-1]       )  # reverse the infix equation

		for i in range(len(A       )       ):
				if infix[i] == "(":
						_UpperCAmelCase							 =		')'  # change "(" to ")"
				elif infix[i] == ")":
						_UpperCAmelCase							 =		'('  # change ")" to "("

		return (infix_2_postfix(''.join(A       )       ))[
		    ::-1
		]  # call infix_2_postfix on Infix, return reverse of Postfix


if __name__ == "__main__":
					lowercase  							=					input('''\nEnter an Infix Equation = ''')  # Input an Infix equation
					lowercase  							=					''''''.join(Infix.split())  # Remove spaces from the input
					print('''\n\t''', Infix, '''(Infix) -> ''', infix_2_prefix(Infix), '''(Prefix)''')







"""simple docstring"""





from __future__ import annotations

from cmath import sqrt




def 	UpperCAmelCase     (		A	:						int     ,				A	:						int     ,				A	:						int       ):

		'''simple docstring'''


		if a == 0:
				raise ValueError('Coefficient \'a\' must not be zero.'       )
		_UpperCAmelCase							 =		b * b - 4 * a * c

		_UpperCAmelCase							 =		(-b + sqrt(A       )) / (2 * a)
		_UpperCAmelCase							 =		(-b - sqrt(A       )) / (2 * a)

		return (
		    root_a.real if not root_a.imag else root_a,
		    root_a.real if not root_a.imag else root_a,
		)




def 	UpperCAmelCase     (		):

		'''simple docstring'''


		_UpperCAmelCase ,					_UpperCAmelCase							 =		quadratic_roots(a=5     ,				b=6     ,				c=1       )
		print(f'The solutions are: {solutiona} and {solutiona}'       )


if __name__ == "__main__":
					main()


