Learn about Python Program to Multiply Two Numbers using Function in the below code example. Also, refer to the comments in the code snippet to get a detailed view about what’s actually happening.
Python Program to Multiply Two Numbers using Function
# Python program to multiply two numbers using function #user-defind function def product_num(num1, num2): num = (num1 * num2) return num num1 = float(input('Enter first number: ')) num2 = float(input('Enter second number: ')) # function call product = product_num(num1, num2) # print result print("The Product of Number: %0.1f" %product)
Enter first number: 8
Enter second number: 5
The Product of Number: 40.0
Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.
Similar Code : Python Program for Multiplication of Two Numbers using user input