title: why variable doesn't store stuff when inside a def funct
body: <p>I'm new to programming!
  when i do:</p>
  
  <pre><code>&gt;&gt;&gt;x = "heyy"
  &gt;&gt;&gt;def hello():
         x = "hi"
  &gt;&gt;&gt;hello()
  &gt;&gt;&gt;print(x)
  heyy
  </code></pre>
  
  <p>why is x still "heyy"?
  is there anyway i can turn x = hi into a global variable? Without using "return" and putting it into a new variable?
  like:</p>
  
  <pre><code>&gt;&gt;&gt;x = "heyy"
  &gt;&gt;&gt;def hello():
      x = "hi"
      return x
  &gt;&gt;&gt;y = hello()
  &gt;&gt;&gt;print(y)
  hi
  </code></pre>
  
  <p>basically I just want to change the contents of <code>x</code> to <code>hi</code> instead of <code>heyy</code> when I run <code>hello()</code></p>