PREREQUISITES
To Practice this Program, you should have a basic knowledge of the following Topics:
WHAT TO DO ?
Ask a website user for two numbers and desired calculation user wants to perform between them.
Calculate both the numbers.
HOW TO DO ?
Following are the steps to do :
</p>
<div class="wp-block-codemirror-blocks-code-block code-block">
<pre>num1 = float(input("Enter the first number "))
num2 = float(input("Enter the second number "))
calculate = input("What calculation do you want to perform ? +, -, /, x ")
</pre>
</div>
<div class="wp-block-codemirror-blocks-code-block code-block"> <pre>if calculate == "+": print(num1 + num2) elif calculate == "-": print(num1-num2) elif calculate == "/": print(num1/num2) elif calculate == "x": print(num1*num2)</pre> </div>
Things We Covered
- Accepting User Data (Input Function with Float)
- Creating IF-ELIF-ELSE (Conditionals)
- Print/Output the Data (Print Function)
Posted by Akshay Gupta
