{"id":31689,"date":"2024-11-01T09:01:45","date_gmt":"2024-11-01T09:01:45","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=31689"},"modified":"2024-11-01T11:48:39","modified_gmt":"2024-11-01T11:48:39","slug":"02-8-basics-of-python-programming-storage-space-for-data-type-values-variables","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/31689\/","title":{"rendered":"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><\/h2>\n\n\n\n<p>For those who are learning Python for the first time, variables are one of the core concepts of programming. A variable refers to a named storage space used to store and manipulate data, allowing the program to perform various operations and obtain desired results. In this course, we will explore in detail what variables are in Python programming, how to use them, and the basic concepts related to variables.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What is a Variable?<\/h3>\n\n\n\n<p>A variable is a named memory space for storing data. Its purposes can be summarized in two main points.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>It stores data.<\/li>\n\n\n\n<li>It can retrieve or change the stored data.<\/li>\n<\/ol>\n\n\n\n<p>In Python, variables can hold various values regardless of data type, and you can access the stored values via the name of the variable. This allows programmers to easily access and manipulate data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Variable Assignment and Basic Syntax in Python<\/h3>\n\n\n\n<p>In Python, there is no need to specify the data type when declaring a variable. You can create a variable and assign a value using the following syntax.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>variable_name = value<\/code><\/pre>\n\n\n\n<p>For example, here\u2019s how to assign a number and a string to a variable:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>x = 10\nname = \"Alice\"<\/code><\/pre>\n\n\n\n<p>In this case, &#8216;x&#8217; stores the number 10, and &#8216;name&#8217; stores the string &#8220;Alice&#8221;. Python automatically determines the type based on the assigned value.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Naming Rules for Variables<\/h3>\n\n\n\n<p>When creating variable names in Python, you must follow these rules:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Variable names can include letters, numbers, and underscores (_).<\/li>\n\n\n\n<li>Variable names cannot start with a number.<\/li>\n\n\n\n<li>Whitespace is not allowed. Instead, you can use underscores (e.g., my_variable).<\/li>\n\n\n\n<li>Pythons reserved words cannot be used as variable names (e.g., <code>def<\/code>,\u00a0<code>class<\/code>, etc.).<\/li>\n<\/ul>\n\n\n\n<p>By following these rules, you can improve the readability of your code and make it easier to maintain.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Dynamic Characteristics of Variables<\/h3>\n\n\n\n<p>Python variables support dynamic typing. This means that a variable can hold values of different types than what it was initially set to. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>x = 10     # Integer\nx = \"Hello\" # String<\/code><\/pre>\n\n\n\n<p>In this case, &#8216;x&#8217; initially holds the integer 10 and later is changed to the string &#8220;Hello&#8221;. This provides programmers with great flexibility.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Variable Scope<\/h3>\n\n\n\n<p>The scope of a variable refers to the area of the program where the variable is valid. Python mainly has two types of scopes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Local Variables:<\/strong> Declared within a function or block and cannot be accessed outside that block.<\/li>\n\n\n\n<li><strong>Global Variables:<\/strong> Declared outside a function block and can be accessed throughout the program.<\/li>\n<\/ul>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>global_var = \"I am global\"\n\ndef my_function():\n    local_var = \"I am local\"\n    print(local_var)\n\nmy_function()\nprint(global_var)\n# print(local_var)  # Error: local_var is only accessible within the function<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Basic Operations on Variables<\/h3>\n\n\n\n<p>Basic operations related to variables include assignment, update, and deletion. In Python, you can perform these operations as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Assign value to variable\nx = 5\n\n# Update variable value\nx = x + 2\n\n# Delete variable\ndel x<\/code><\/pre>\n\n\n\n<p>Variables allow for easy referencing and modification of the assigned data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Memory Management of Variables<\/h3>\n\n\n\n<p>The Python interpreter manages variables and automatically handles memory through a garbage collector. When the reference count of a variable reaches zero, the associated memory is automatically freed, allowing for effective resource management.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Variable and Object Reference<\/h3>\n\n\n\n<p>In Python, variables do not directly store objects but reference them. This means that multiple variables can reference a single object. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a = [1, 2, 3]\nb = a<\/code><\/pre>\n\n\n\n<p>Here, &#8216;a&#8217; and &#8216;b&#8217; reference the same list object. This means that changes will be reflected in all referencing variables.<\/p>\n\n\n\n<p>Understanding these characteristics is important to avoid unexpected errors when manipulating data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p>In Python, variables are essential for storing and manipulating data. Variable names should be written accurately and clearly, and understanding the dynamic characteristics and scope of variables helps minimize errors in the program. Familiarizing yourself with the concepts and functions of variables as a foundation of Python programming will enhance your programming efficiency and provide a basic framework for solving more complex problems.<\/p>\n\n\n\n<p>Based on these fundamental concepts, try writing programs and exploring Python&#8217;s various data types and functionalities. In the next course, we will delve into more advanced topics.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For those who are learning Python for the first time, variables are one of the core concepts of programming. A variable refers to a named storage space used to store and manipulate data, allowing the program to perform various operations and obtain desired results. In this course, we will explore in detail what variables are &hellip; <a href=\"https:\/\/atmokpo.com\/w\/31689\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[98],"tags":[95],"class_list":["post-31689","post","type-post","status-publish","format-standard","hentry","category--en","tag--en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/31689\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"For those who are learning Python for the first time, variables are one of the core concepts of programming. A variable refers to a named storage space used to store and manipulate data, allowing the program to perform various operations and obtain desired results. In this course, we will explore in detail what variables are &hellip; \ub354 \ubcf4\uae30 &quot;02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/31689\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:01:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:48:39+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/31689\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31689\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables\",\"datePublished\":\"2024-11-01T09:01:45+00:00\",\"dateModified\":\"2024-11-01T11:48:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31689\/\"},\"wordCount\":624,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"keywords\":[\"\ud30c\uc774\uc36c\uac15\uc88c\"],\"articleSection\":[\"Python Study\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/31689\/\",\"url\":\"https:\/\/atmokpo.com\/w\/31689\/\",\"name\":\"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:01:45+00:00\",\"dateModified\":\"2024-11-01T11:48:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/31689\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/31689\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/31689\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","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:\/\/atmokpo.com\/w\/31689\/","og_locale":"ko_KR","og_type":"article","og_title":"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"For those who are learning Python for the first time, variables are one of the core concepts of programming. A variable refers to a named storage space used to store and manipulate data, allowing the program to perform various operations and obtain desired results. In this course, we will explore in detail what variables are &hellip; \ub354 \ubcf4\uae30 \"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables\"","og_url":"https:\/\/atmokpo.com\/w\/31689\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:01:45+00:00","article_modified_time":"2024-11-01T11:48:39+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/31689\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/31689\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables","datePublished":"2024-11-01T09:01:45+00:00","dateModified":"2024-11-01T11:48:39+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/31689\/"},"wordCount":624,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"keywords":["\ud30c\uc774\uc36c\uac15\uc88c"],"articleSection":["Python Study"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/31689\/","url":"https:\/\/atmokpo.com\/w\/31689\/","name":"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:01:45+00:00","dateModified":"2024-11-01T11:48:39+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/31689\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/31689\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/31689\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"02-8 Basics of Python Programming, Storage Space for Data Type Values, Variables"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31689","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=31689"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31689\/revisions"}],"predecessor-version":[{"id":31690,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/31689\/revisions\/31690"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=31689"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=31689"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=31689"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}