Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 862 Bytes

Basic Operations.md

File metadata and controls

44 lines (35 loc) · 862 Bytes

Python Code that Displays Addition, Subtraction, Division and Multiplication of 2 numbers

Initializing Variables x and y as 10 and 5 respectively

x = 10
y = 5

Basic operators only requirement is having 2 variables with the operator symbol between

Addition example

add = x + y

Subtraction example

sub = x - y

Division example

div = x / y

Multiplication example

mul = x * y

Printing out the results

print(f'Addition of {x} and {y} is {add}')
print(f'Subtraction of {x} and {y} is {sub}')
print(f'Division of {x} and {y} is {div}')
print(f'Multiplication of {x} and {y} is {mul}')

Output:

Addition of 10 and 5 is 15
Subtraction of 10 and 5 is 5
Division of 10 and 5 is 2.0
Multiplication of 10 and 5 is 50