forked from geojames/Dart_EnvGIS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWeek3-2_zdebuggingFOR.py
57 lines (40 loc) · 1.41 KB
/
Week3-2_zdebuggingFOR.py
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
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
__author__ = 'James T. Dietrich'
__contact__ = '[email protected]'
__copyright__ = '(c) James Dietrich 2016'
__license__ = 'MIT'
__date__ = 'Wed Nov 16 11:33:39 2016'
__version__ = '1.0'
__status__ = "initial release"
__url__ = "https://github.com/geojames/..."
"""
Name: Week3-2_zdebuggingFOR.py
Compatibility: Python 3.5
Description: This program does stuff
URL: https://github.com/geojames/...
Requires: libraries
Dev ToDo:
AUTHOR: James T. Dietrich
ORGANIZATION: Dartmouth College
Contact: [email protected]
Copyright: (c) James Dietrich 2016
"""
#------------------------------------------------------------------------------
# Debugging FOR
# basic for loop
my_list = [3,6,12,334,-33,300]
for item in my_list:
print(item)
#-------
# ex. Two lists, calculate value for first value apply that to another list
slope_percent = [6,20,100]
distance = [10,50,100,500,1000]
# convert slope_percent to gradient and calc drop over given distances
for slp in slope_percent:
for dist in distance:
slp_grad = slp / 100
drop = slp_grad * dist
print ("A slope of %.3f over %i meters is a %.2f meter drop" %(slp_grad,\
dist,drop))