Take 2 variables for user input and display the sum within another variable in Pythan

 Solution : 

num1=input("Enter First Number :")
num2=input ("Enter Second Number :")
sum=float(num1)+float(num2)
print("The sum of {0} and {1} is {2}".format(num1,num2,sum))


OR

x=input("Enter 1st number:")
y=input("Enter 2nd number:")

z=int(x)+int(y)
#int() used for convert data into integer

print("Sum=",z)



Comments