Skip to content

Instantly share code, notes, and snippets.

@TomoG29
Created February 28, 2023 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomoG29/1c6eac88e80b2b459c856c202cb63792 to your computer and use it in GitHub Desktop.
Save TomoG29/1c6eac88e80b2b459c856c202cb63792 to your computer and use it in GitHub Desktop.
Sample_Var = 0
def Process1():
Sample_Var = 1
def Process2():
global Sample_Var
Sample_Var = 1
def Process3():
global Sample_Var = 1
Process1()
print(f"1点目:{Sample_Var}")
# 1点目:0
Process2()
print(f"2点目:{Sample_Var}")
# 2点目:1
Process3()
print(f"3点目:{Sample_Var}")
# エラー
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment