subtract two numbers in python

In Python, you can subtract two numbers using the - operator. Here's an example:

main.py
a = 10
b = 5
c = a - b
print(c)
32 chars
5 lines

Output: 5

In this example, we first define two variables a and b and set them to the values 10 and 5, respectively. We then use the - operator to subtract b from a and store the result in a new variable c. Finally, we print the value of c, which is 5.

Alternatively, you can directly subtract two numbers without using any variables, like this:

main.py
print(10 - 5) # Output: 5
26 chars
2 lines

In this example, we directly subtract 5 from 10 using the - operator and print the result, which is 5.

gistlibby LogSnag