Solution

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

# input request

import math
def math_helper():
print("Welcome to the simple math helper.")
while True:
print("Would you like to calculate?")
print("1. Sqrt")
print("2. Log")
print("3. Factorial")
choice = int(input())
if 1<= choice <= 3:
break
else:
print("Enter valid choice")
if choice == 1:
print("Enter the number to sqrt:")
num = int(input())
return math.sqrt(num)
elif choice == 2:
print("Enter the number to choice:")
num = int(input())
return math.log(num)
else:
print("Enter the number to factorial:")
num = int(input())
return math.factorial(num)
print(math_helper())

You might also like