{"id":6745,"date":"2015-10-16T07:37:46","date_gmt":"2015-10-16T07:37:46","guid":{"rendered":"https:\/\/www.pythonforbeginners.com\/?p=6745"},"modified":"2020-08-27T09:18:15","modified_gmt":"2020-08-27T14:18:15","slug":"numeric-types-python","status":"publish","type":"post","link":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python","title":{"rendered":"Numeric Types in Python"},"content":{"rendered":"<div>In any OOP language, there are many different data types. In Python, number data types are used to store numeric values. There are four different numerical types in Python:<\/div>\n<div>\n<ol>\n<li>int (plain integers): this one is pretty standard &#8212; plain integers are just positive or negative whole numbers.<\/li>\n<li>long (long integers): long integers are integers of infinite size. They look just like plain integers except they&#8217;re followed by the letter &#8220;L&#8221; (ex: 150L).<\/li>\n<li>float (floating point real values): floats represent real numbers, but are written with decimal points (or scientific notaion) to divide the whole number into fractional parts.&nbsp;<\/li>\n<li>complex (complex numbers): represented by the formula a + bJ, where a and b are floats, and J is the square root of -1 (the result of which is an imaginary number). Complex numbers are used sparingly in Python.&nbsp;<\/li>\n<\/ol>\n<\/div>\n<div>&nbsp;<\/div>\n<div>Applying the function call operator () to a numeric type creates an instance of that type. For example: calling int(x) will convert x to a plain integer. This can also be used with the long, float, and complex types.&nbsp;<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In any OOP language, there are many different data types. In Python, number data types are used to store numeric values. There are four different numerical types in Python: int (plain integers): this one is pretty standard &#8212; plain integers are just positive or negative whole numbers. long (long integers): long integers are integers of [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[96,175],"tags":[],"class_list":{"0":"post-6745","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-basics","7":"category-code","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Numeric Types in Python - PythonForBeginners.com<\/title>\n<meta name=\"description\" content=\"Numeric Types in Python will help you improve your python skills with easy to follow examples and tutorials. Click here to view code examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Numeric Types in Python - PythonForBeginners.com\" \/>\n<meta property=\"og:description\" content=\"Numeric Types in Python will help you improve your python skills with easy to follow examples and tutorials. Click here to view code examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python\" \/>\n<meta property=\"og:site_name\" content=\"PythonForBeginners.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pythonbeginners\" \/>\n<meta property=\"article:published_time\" content=\"2015-10-16T07:37:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-08-27T14:18:15+00:00\" \/>\n<meta name=\"author\" content=\"PFB Staff Writer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pythonbeginners\" \/>\n<meta name=\"twitter:site\" content=\"@pythonbeginners\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"PFB Staff Writer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python\"},\"author\":{\"name\":\"PFB Staff Writer\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#\\\/schema\\\/person\\\/1f49841b9ba76108d92e7ef1ca5ee648\"},\"headline\":\"Numeric Types in Python\",\"datePublished\":\"2015-10-16T07:37:46+00:00\",\"dateModified\":\"2020-08-27T14:18:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python\"},\"wordCount\":184,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#organization\"},\"articleSection\":[\"Basics\",\"Code\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python\",\"url\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python\",\"name\":\"Numeric Types in Python - PythonForBeginners.com\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#website\"},\"datePublished\":\"2015-10-16T07:37:46+00:00\",\"dateModified\":\"2020-08-27T14:18:15+00:00\",\"description\":\"Numeric Types in Python will help you improve your python skills with easy to follow examples and tutorials. Click here to view code examples.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/basics\\\/numeric-types-python#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Numeric Types in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#website\",\"url\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/\",\"name\":\"PythonForBeginners.com\",\"description\":\"Learn By Example\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#organization\",\"name\":\"PythonForBeginners.com\",\"url\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/PFB-Logo-Final.png\",\"contentUrl\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/wp-content\\\/uploads\\\/2020\\\/05\\\/PFB-Logo-Final.png\",\"width\":1868,\"height\":318,\"caption\":\"PythonForBeginners.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/pythonbeginners\",\"https:\\\/\\\/x.com\\\/pythonbeginners\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/#\\\/schema\\\/person\\\/1f49841b9ba76108d92e7ef1ca5ee648\",\"name\":\"PFB Staff Writer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43a6730888902641f2b8e13d1eb78522f178077d85b17a796302635c434a3ac0?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43a6730888902641f2b8e13d1eb78522f178077d85b17a796302635c434a3ac0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/43a6730888902641f2b8e13d1eb78522f178077d85b17a796302635c434a3ac0?s=96&d=mm&r=g\",\"caption\":\"PFB Staff Writer\"},\"url\":\"https:\\\/\\\/www.pythonforbeginners.com\\\/author\\\/pfb_staff\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Numeric Types in Python - PythonForBeginners.com","description":"Numeric Types in Python will help you improve your python skills with easy to follow examples and tutorials. Click here to view code examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python","og_locale":"en_US","og_type":"article","og_title":"Numeric Types in Python - PythonForBeginners.com","og_description":"Numeric Types in Python will help you improve your python skills with easy to follow examples and tutorials. Click here to view code examples.","og_url":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python","og_site_name":"PythonForBeginners.com","article_publisher":"https:\/\/www.facebook.com\/pythonbeginners","article_published_time":"2015-10-16T07:37:46+00:00","article_modified_time":"2020-08-27T14:18:15+00:00","author":"PFB Staff Writer","twitter_card":"summary_large_image","twitter_creator":"@pythonbeginners","twitter_site":"@pythonbeginners","twitter_misc":{"Written by":"PFB Staff Writer","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python#article","isPartOf":{"@id":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python"},"author":{"name":"PFB Staff Writer","@id":"https:\/\/www.pythonforbeginners.com\/#\/schema\/person\/1f49841b9ba76108d92e7ef1ca5ee648"},"headline":"Numeric Types in Python","datePublished":"2015-10-16T07:37:46+00:00","dateModified":"2020-08-27T14:18:15+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python"},"wordCount":184,"commentCount":0,"publisher":{"@id":"https:\/\/www.pythonforbeginners.com\/#organization"},"articleSection":["Basics","Code"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python","url":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python","name":"Numeric Types in Python - PythonForBeginners.com","isPartOf":{"@id":"https:\/\/www.pythonforbeginners.com\/#website"},"datePublished":"2015-10-16T07:37:46+00:00","dateModified":"2020-08-27T14:18:15+00:00","description":"Numeric Types in Python will help you improve your python skills with easy to follow examples and tutorials. Click here to view code examples.","breadcrumb":{"@id":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pythonforbeginners.com\/basics\/numeric-types-python#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pythonforbeginners.com\/"},{"@type":"ListItem","position":2,"name":"Numeric Types in Python"}]},{"@type":"WebSite","@id":"https:\/\/www.pythonforbeginners.com\/#website","url":"https:\/\/www.pythonforbeginners.com\/","name":"PythonForBeginners.com","description":"Learn By Example","publisher":{"@id":"https:\/\/www.pythonforbeginners.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pythonforbeginners.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pythonforbeginners.com\/#organization","name":"PythonForBeginners.com","url":"https:\/\/www.pythonforbeginners.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pythonforbeginners.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.pythonforbeginners.com\/wp-content\/uploads\/2020\/05\/PFB-Logo-Final.png","contentUrl":"https:\/\/www.pythonforbeginners.com\/wp-content\/uploads\/2020\/05\/PFB-Logo-Final.png","width":1868,"height":318,"caption":"PythonForBeginners.com"},"image":{"@id":"https:\/\/www.pythonforbeginners.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pythonbeginners","https:\/\/x.com\/pythonbeginners"]},{"@type":"Person","@id":"https:\/\/www.pythonforbeginners.com\/#\/schema\/person\/1f49841b9ba76108d92e7ef1ca5ee648","name":"PFB Staff Writer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/43a6730888902641f2b8e13d1eb78522f178077d85b17a796302635c434a3ac0?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/43a6730888902641f2b8e13d1eb78522f178077d85b17a796302635c434a3ac0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/43a6730888902641f2b8e13d1eb78522f178077d85b17a796302635c434a3ac0?s=96&d=mm&r=g","caption":"PFB Staff Writer"},"url":"https:\/\/www.pythonforbeginners.com\/author\/pfb_staff"}]}},"jetpack_publicize_connections":[],"featured_image_src":null,"featured_image_src_square":null,"author_info":{"display_name":"PFB Staff Writer","author_link":"https:\/\/www.pythonforbeginners.com\/author\/pfb_staff"},"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/posts\/6745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/comments?post=6745"}],"version-history":[{"count":2,"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/posts\/6745\/revisions"}],"predecessor-version":[{"id":8108,"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/posts\/6745\/revisions\/8108"}],"wp:attachment":[{"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/media?parent=6745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/categories?post=6745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pythonforbeginners.com\/wp-json\/wp\/v2\/tags?post=6745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}