Answer:
Written using Python 3:
num1 = int(input("Enter first value: "))
num2 = int(input("Enter second value: "))
finalResult =(num1+num2) / 3
print("Answer is: ", finalResult)
INPUT:
Enter first value: 4
Enter second value: 5
OUTPUT:
Answer is: 3
Step-by-step explanation:
First step is to declare the variables:
Second is to ask for an input:
- input("Enter first value: ")
Then we need to convert them into integers by encapsulating the line above inside int(). This is a requirement before you can do any mathematical operations with the given values.
- num1 = int(input("Enter first value: "))
Next is to calculate:
- finalResult =(num1+num2) / 3
- Here we first add the values of num1 and num2, then divide the sum by 3.
And to test if the output is correct, let us print it:
- print("Answer is: ", finalResult)
- print() - when used for strings/texts, use quotation marks like: "text here"
- but when used to print variables and numbers (integers, floats, etc), there is no need to enclose them with quotation marks.
- to concatenate string and an integer (in this case the variable finalResult), simply add a comma right after the string.