Calculate the +,- ,* and / of two user given no.s using function and return type.

Asked: Anonymously |Category: Python

def func(a,b):

add=a+b

sub=a-b

mul=a*b

div=a/b

return (add,sub,mul,div);

a=int(input("Enter the 1st number: "))

b=int(input("Enter the 2nd number: "))

add,sub,mul,div=func(a,b)

print("sum=",add,"substract=",sub,"multiply=",mul,"division=",div)

6 views0 comments

Recent Posts

See All

Binary string reduction in Python

Asked: Sudeep |Category: Python x=int(input("Enter the value of x : ")) for i in range(x): n=int(input("Enter the value of n : ")) y=input("Enter the value of y : ") l=list(y) k=0

"Believe you can and you're halfway there"