How can I write a program to add two numbers using functions in python

0 votes
Is there a built-in function to add numbers?
May 16, 2019 in Python by Waseem
• 4,540 points
17,043 views

2 answers to this question.

0 votes

def add(a,b):

     return a + b

#when i call this function with arguments it will print the addition of the two numbers

print(add(10,15))

Hope this will help!

If you need to know more about Python, join Python certification course online today.

Thanks!

answered May 20, 2019 by Mohammad
• 3,230 points
return add ##make this changes here add function will be called
0 votes
there is sum() function as a built in for addition.
answered Oct 24, 2020 by anonymous

Related Questions In Python

+1 vote
1 answer
0 votes
1 answer

How can I define a multidimensional array in python using ctype?

Here's one quick-and-dirty method: >>> A = ((ctypes.c_float ...READ MORE

answered Oct 9, 2018 in Python by aryya
• 7,440 points
2,079 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,368 views
0 votes
0 answers
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,780 views
0 votes
1 answer

how do I check the length of an array in a python program?

lets say we have a list mylist = ...READ MORE

answered Mar 12, 2019 in Python by Mohammad
• 3,230 points
384 views
0 votes
1 answer

How can I find the square of a number in python?

You can use the exponentiation operator or ...READ MORE

answered May 20, 2019 in Python by Mohammad
• 3,230 points
272 views