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,530 points
2,570 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, 2019 by Mohammad
• 3,210 points

Related Questions In Python

0 votes
1 answer

How can I write code to find a palindrome in python without using string functions?

In Logic 1, try if i<int(length/2): instead of if i<int((length/2+1)): In ...READ MORE

answered Jan 16, 2019 in Python by charlie_brown
• 7,760 points
5,816 views
+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,350 points
737 views
0 votes
1 answer
+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 765 views
0 votes
0 answers
+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, 2019 in Python by Mohammad
• 3,210 points
128 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,210 points
78 views