Help me in solving PYTH54 problem

My issue

Write a program which does the following

Create a calculator
Initialize the variables a and b based on two user inputs
Declare an integer variable sum - and store the value of addition of a and b
Declare an integer variable diff - and store the value of subtraction of a and b
Output sum and diff to the console on separate line

cant able to get output…

My code

# Update your code below this line

a = int(input(35))
b = int(input(23))
sum=a+b
diff=a-b
print("sum of",a,"and",b,"is",sum)
print("diff of",a,"and",b,"is",diff)

Learning course: Python with Data structures
Problem Link: Calculator Practice Problem in Python with Data structures - CodeChef

Create a calculator

def calculator():
# Initialize the variables a and b based on two user inputs
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))

# Declare an integer variable sum - and store the value of addition of a and b
sum = a + b

# Declare an integer variable diff - and store the value of subtraction of a and b
diff = a - b

# Output sum and diff to the console on separate lines
print("The sum is: ", sum)
print("The difference is: ", diff)

Call the function

calculator()

1 Like

thank you sir