About 682,000 results
Open links in new tab
  1. Python Program to Add Two Numbers

    # This program adds two numbers num1 = 1.5 num2 = 6.3 # Add two numbers sum = num1 + num2 # Display the sum print('The sum of {0} and {1} is {2}'.format(num1, num2, sum))

  2. sum of two numbers coming from the command line - Stack Overflow

    Aug 31, 2009 · You should do this: import sys a, b = sys.argv[1:2] summ = int(a) + int(b) print "sum is", summ There is no need for str () when printing an integer. But you should use int () if …

  3. How to Add Two Numbers in Python - W3Schools

    Learn how to add two numbers in Python. Use the + operator to add two numbers: In this example, the user must input two numbers. Then we print the sum by calculating (adding) the …

  4. Python Project: Summing Up Two Numbers from User Input

    Mar 31, 2025 · Write a Python script that asks the user for two numbers, converts them to integers, sums them up, and prints the result.

  5. Python Program to Add Two Numbers with User Input

    num2 = int(input('Enter second number: ')) # calling function sum = add_num(num1, num2) # print sum of numbers print('The sum of numbers {0} and {1} is {2}'.format(num1, num2, sum))

  6. How To Add Two Numbers In Python? - Python Guides

    Nov 4, 2024 · This tutorial will help you understand how to perform such calculations efficiently using Python. To add two numbers in Python, you can define a simple function that takes two …

  7. Python Program to Add two Numbers using Command Line …

    In this article, we will learn about python program to add two numbers using command line arguments. The task is write a python program that returns sum of two numbers provided as …

  8. Python | Input two integers and find their addition

    Apr 8, 2023 · The task is to input two integer numbers, and find their addition/sum in Python. To add two integers, input the integer values into two variables, perform the addition operation …

  9. Python program to enter two numbers and find their sum

    Nov 18, 2021 · Python program to the sum of two integers # Python program to the sum of two integers print("Enter two integer values::\n") p, q, r = int(input()), int(input()), 0 r = p + q …

  10. How to Print Sum of Two Numbers in Python - Know Program

    num2 = int(input('Enter second number: ')) # calling function sum = add_num(num1, num2) # print sum of numbers print('The sum of numbers {0} and {1} is {2}'.format(num1, num2, sum))

Refresh