Your browser does not support JavaScript!
Upvotes Anonymous 2 User 0

Numbers in Python

It's easy to crunch numbers in Python. Let's add two numbers and print the result:
print(1.5 + 2)
The result of running this code is:
We can also store the numbers in variables, and then add the values using the variables:
a = 1.5
b = 2
print(a + b)
Variables are often used to store input from users (e.g. if we created a calculator application), and then do things with those values later.
Was this helpful?


Leave a Comment

I agree to the Terms of Service
Design © 2015, Downranked, LLC.,
Original user code contributions under MIT License