{"id":1511,"date":"2022-02-18T01:06:53","date_gmt":"2022-02-18T01:06:53","guid":{"rendered":"https:\/\/mypythonfundamentals.com\/?p=1511"},"modified":"2023-01-31T04:04:18","modified_gmt":"2023-01-31T04:04:18","slug":"data-types","status":"publish","type":"post","link":"https:\/\/mypythonfundamentals.com\/index.php\/2022\/02\/18\/data-types\/","title":{"rendered":"Data Types"},"content":{"rendered":"\n<p>In Python, the following are the commonly used data types:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li><strong>int (integers)<\/strong> &#8211; a whole number that can be positive, negative, or zero. For example: -10, 0, 100.<\/li><li><strong>float (floating-point numbers)<\/strong> &#8211; a decimal number that can be positive, negative, or zero. For example: -10.0, 0.0, 100.0.<\/li><li><strong>str (strings)<\/strong> &#8211; a sequence of characters. For example: &#8220;Hello, World!&#8221;, &#8220;123&#8221;, &#8220;abc&#8221;.<\/li><li><strong>bool (Boolean values)<\/strong> &#8211; a data type with two possible values, True or False. Used to represent binary choices or logical values.<\/li><li><strong>list <\/strong>&#8211; an ordered collection of objects. Lists are mutable, meaning the elements of a list can be changed. For example: [1, 2, 3, 4, 5].<\/li><li><strong>tuple <\/strong>&#8211; an ordered, immutable collection of objects. Tuples cannot be changed after they are created. For example: (1, 2, 3, 4, 5).<\/li><li><strong>dict (dictionaries) <\/strong>&#8211; an unordered collection of key-value pairs. Dictionaries are mutable, meaning their elements can be changed. For example: {&#8220;name&#8221;: &#8220;John&#8221;, &#8220;age&#8221;: 30}.<\/li><li><strong>set<\/strong> &#8211; an unordered collection of unique elements. Sets are mutable and can be used to remove duplicates from a list. For example: {1, 2, 3, 4, 5}.<\/li><li><strong>None <\/strong>&#8211; a special constant used to represent the absence of a value. For example, when a function doesn&#8217;t return a value, it is equivalent to returning None.<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In Python, the following are the commonly used data types: int (integers) &#8211; a whole number that can be positive, negative, or zero. For example: -10, 0, 100. float (floating-point numbers) &#8211; a decimal number that can be positive, negative, &hellip; <a href=\"https:\/\/mypythonfundamentals.com\/index.php\/2022\/02\/18\/data-types\/\">Continued<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"redux-templates_canvas","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1511","post","type-post","status-publish","format-standard","hentry","category-data-types"],"_links":{"self":[{"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/posts\/1511","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/comments?post=1511"}],"version-history":[{"count":3,"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/posts\/1511\/revisions"}],"predecessor-version":[{"id":1565,"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/posts\/1511\/revisions\/1565"}],"wp:attachment":[{"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/media?parent=1511"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/categories?post=1511"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mypythonfundamentals.com\/index.php\/wp-json\/wp\/v2\/tags?post=1511"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}