{"id":215,"date":"2023-03-14T04:01:19","date_gmt":"2023-03-14T04:01:19","guid":{"rendered":"https:\/\/joseph-t-gordon.tech\/?p=215"},"modified":"2023-06-26T14:22:28","modified_gmt":"2023-06-26T14:22:28","slug":"post-32-operators-within-python","status":"publish","type":"post","link":"https:\/\/joseph-t-gordon.tech\/index.php\/2023\/03\/14\/post-32-operators-within-python\/","title":{"rendered":"Post #32 (Python Programming) &#8211; Operators within Python"},"content":{"rendered":"\n<p>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.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>+ Adds the two pieces of date<\/p>\n\n\n\n<p>print(3 + 4)<\/p>\n\n\n\n<p>7<\/p>\n\n\n\n<p>\/ Divides two pieces of data, this result always returns a float<\/p>\n\n\n\n<p>print(8 \/ 2)<\/p>\n\n\n\n<p>4.0<\/p>\n\n\n\n<p>\/\/ Divides two pieces of data, always rounds the result and returns and integer<\/p>\n\n\n\n<p>print(8 \/\/ 2)<\/p>\n\n\n\n<p>4<\/p>\n\n\n\n<p>&#8211; Subtracts two pieces of data<\/p>\n\n\n\n<p>print(2 &#8211; 1)<\/p>\n\n\n\n<p>1<\/p>\n\n\n\n<p>* Multiples two pieces of data<\/p>\n\n\n\n<p>print(2 * 2)<\/p>\n\n\n\n<p>4<\/p>\n\n\n\n<p>% Divides two pieces of data and returns the remainder<\/p>\n\n\n\n<p>print(14 % 5)<\/p>\n\n\n\n<p>4<\/p>\n\n\n\n<p>** Used to represent an exponent 2^2 represented as 2 ** 2<\/p>\n\n\n\n<p>print(3 ** 3)<\/p>\n\n\n\n<p>27<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/posts\/215"}],"collection":[{"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/comments?post=215"}],"version-history":[{"count":2,"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/posts\/215\/revisions"}],"predecessor-version":[{"id":316,"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/posts\/215\/revisions\/316"}],"wp:attachment":[{"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/media?parent=215"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/categories?post=215"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joseph-t-gordon.tech\/index.php\/wp-json\/wp\/v2\/tags?post=215"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}