Skip to content

Joseph-T-Gordon

A complete log of all recent projects and skills

Menu
  • About me
  • Posts/Projects
  • Resume/Certifications
Menu

Post #32 (Python Programming) – Operators within Python

Posted on March 14, 2023June 26, 2023 by admin

Python, although it is a very simple use of the language, is actually useful as a calculator. I will go through some of the examples with the print function and what their result would be. It is important to note with the exception of // if a float is contained in the command the result will be a float. Also python following the order of operation and multiple operators as well as parenthesis can be used in the command for more complex expressions.

+ Adds the two pieces of date

print(3 + 4)

7

/ Divides two pieces of data, this result always returns a float

print(8 / 2)

4.0

// Divides two pieces of data, always rounds the result and returns and integer

print(8 // 2)

4

– Subtracts two pieces of data

print(2 – 1)

1

* Multiples two pieces of data

print(2 * 2)

4

% Divides two pieces of data and returns the remainder

print(14 % 5)

4

** Used to represent an exponent 2^2 represented as 2 ** 2

print(3 ** 3)

27

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2025 Joseph-T-Gordon | Powered by Minimalist Blog WordPress Theme