Program 39: Take two numbers as input and print their product.

Question: Write a Python Program to take two numbers as input and print their product.


# Step 1: Store number 1st in varable num1 as user input
num1 = float(input("Enter the first number: "))

# Step 2: Store number 2nd in varable num2 as user input
num2 = float(input("Enter the secnod number: "))

# Step 3: Calculate their sum
sum_of_numbers = num1 + num2

# Step 4: Print the sum
print(f"The sum of {num1} and {num2} is {sum_of_numbers}")

Enter the first number: 10 Enter the second number: 15 The sum of 10.0 and 15.0 is 25.0

Notebook Example:

Notebook Demo - add two numbers as user input Python

These Python programs are created by experienced programmers to aid students in learning Python. We are here to make your learning experience as interactive and informative as possible. If you have questions or need more clarification, feel free to ask. Happy coding!

Please support independent contributors like Code2care by donating a coffee.

Buy me a coffee!

Buy Code2care a Coffee!

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap