Python Editor

Showing posts with label Python | Lesson3 | Functions - Addition. Show all posts
Showing posts with label Python | Lesson3 | Functions - Addition. Show all posts

Python | Lesson3 | Functions - Addition


def add(x, y):
   "This function adds two numbers"
   return x + y

num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))

print("sum of num1,num2 =", add(num1,num2))


# Todo :  Create Subtraction, Multiplication and division functions,
# and print the results using the functions similar to add function