GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python/Global_local_var.py at master · kudou/Python

Expand file tree

/

Global_local_var.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
44 lines (30 loc) · 568 Bytes
/

Global_local_var.py

Copy path

File metadata and controls

44 lines (30 loc) · 568 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# global vs local variable
# num1 is a global variable
num1 = 1
print num1
# num2 is a local variable
def func():
num1 = 2
num2 = num1 + 1
print num2
func()
print float(2)/3
print num1
def fahren_to_kelvin(fahren):
celsius = float(5) / 9 * (fahren - 32)
zero_celsius_in_kelvin = 273.15
return celsius + zero_celsius_in_kelvin
print fahren_to_kelvin(32)
print fahren_to_kelvin(212)
num = 20
def func1():
global num
num += 1
def func2():
global num
num += 2
print num
func1()
print num
func2()
print num
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.