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 in Python by Waseem
• 4,270 points
46 views

1 answer 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))
answered May 20 by Mohammad
• 3,060 points

Related Questions In Python

0 votes
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 ariaholic
• 7,340 points
266 views
0 votes
1 answer

How can I rename multiple files in a certain directory using Python?

Use os.rename(src, dst) to rename or move a file ...READ MORE

answered Nov 23, 2018 in Python by ariaholic
• 7,340 points
105 views
0 votes
1 answer

How can I have only positive decimal numbers in Django using Python?

Hi, are you aware of something called ...READ MORE

answered Jan 30 in Python by Nymeria
• 3,520 points
316 views
+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 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 175 views
+4 votes
6 answers
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 in Python by Mohammad
• 3,060 points
33 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 in Python by Mohammad
• 3,060 points
23 views