fork download
  1. # Online Python - IDE, Editor, Compiler, Interpreter
  2.  
  3. def sum(a, b):
  4. return (a + b)
  5.  
  6. a = int(input('Enter 1st number: '))
  7. b = int(input('Enter 2nd number: '))
  8.  
  9. print(f'Sum of {a} and {b} is {sum(a, b)}')
  10. print("Sum of " + str(a) + " and " + str(b) + " is " + str(sum(a, b)))
  11. print("Sum of %s and %s is %s" % (a, b, sum(a, b)))
Success #stdin #stdout 0.03s 9740KB
stdin
5
10
stdout
Enter 1st number: Enter 2nd number: Sum of 5 and 10 is 15
Sum of 5 and 10 is 15
Sum of 5 and 10 is 15