I have been learning python3 for around two hours and I decided to create a little program that adds, divides or multiplies numbers. For some reason, the option is supposedly 'not defined' in this program when the user clearly inputs something for it.
def ask_numbers():
num1 = input("Please enter a number: ")
num2 = input("Please enter another number: ")
def add_div_mul():
option = input("Would you like to divide, multiply or add your numbers?")
def multiply_nums(num1, num2):
numsmultiplied = float(num1) * float(num2)
print(numsmultiplied)
def add_nums(num1, num2):
numsadded = float(num1) + float(num2)
print(numsadded)
def divide_nums(num1, num2):
numsdivided = float(num1) / float(num2)
print(numsdivided)
ask_numbers()
add_div_mul()
if option == "multiply": multiply_nums()
if option == "add": add_nums()
if option == "divide": divide_nums()