---
title: "Discussion on \"Python Basics — Day 17 Local vs Global Variables & Scope\" | Hashnode"
description: "Discussion on \"Python Basics — Day 17 Local vs Global Variables & Scope\". 01. Local Variables\n\nDeclared inside a function\n\nExist only while the function is running\n\n\ndef show_number():\n    x = 10   # Local variable\n    print(\"Inside function:\", x)\n\nshow_number()\n# print(x)   # Error! (x is not defined outside the function)..."
url: "https://hashnode.com/posts/python-basics-day-17-local-vs-global-variables-and-scope/68e0e332716911a6dfbb8065"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Python Basics — Day 17 Local vs Global Variables & Scope](https://sabinsim.hashnode.dev/python-basics-day-17-local-vs-global-variables-and-scope?utm_source=hashnode&utm_medium=feed)

01\. Local Variables Declared inside a function Exist only while the function is running def show\_number(): x = 10 # Local variable print("Inside function:", x) show\_number() # print(x) # Error! (x is not defined outside the function)...

Oct 4, 2025 · 2 min read · sabinsim.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#devops](https://hashnode.com/tag/devops)
-   [#developer](https://hashnode.com/tag/developer)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#software-engineering](https://hashnode.com/tag/software-engineering)

## Written by

[Sabin Sim](https://hashnode.com/@sabinsim)

@sabinsim · Graubunden, Switzerland

  
[View profile](https://hashnode.com/@sabinsim)

Coding, Learning, Growing — one project at a time

Aspiring Full-Stack Developer | Python · Django · React · SQL | documenting my learning journey Building skills in Python and full-stack development, with a focus on web apps and system design Junior developer in training — Python, Django, React — preparing for a career in full-stack engineering From Python basics to full-stack projects, sharing my progress as I grow into a developer Future full-stack engineer | Learning in public: Python, APIs, Databases, and Web Development

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
