Python program to do arithmetical operations
The arithmetic operations are performed by calculator where we can perform addition, subtraction, multiplication and division. This example shows the basic arithmetic operations i.e.
Let's understand the following example.
Enter first number: 10 Enter second number: 20 The sum of 10 and 20 is 30.0 The subtraction of 10 and 20 is -10.0 The multiplication of 10 and 20 is 200.0 The division of 10 and 20 is 0.5
In the above code, we have taken the user input as an integer using the input() function. Then, we have performed the arithmetical operation on the given numbers and print the result using the print statement. We used the format() method to format the string
Note - To learn more about the format() method, visit our format() method tutorial.
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected]
Duration: 1 week to 2 week