forked from geojames/Dart_EnvGIS
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathWeek2-3_zdebuggingIF.py
54 lines (43 loc) · 1.43 KB
/
Week2-3_zdebuggingIF.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
#!/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: Week2-3_zdebuggingIF.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
"""
#------------------------------------------------------------------------------
import random as rand
# DEBUGGING
#
# Debugging allows us to run our code line by line to find errors
# - In basic code it’s fairly easy to spot errors, but with IFs and loops
# things can get complicated.
rand_A = rand.randint(0,1000)
rand_B = rand.randint(0,1000)
print("Rand_A = %i and Rand_B = %i" %(rand_A,rand_B))
if rand_A < 300 and rand_B < 300:
print("A and B are less then 100")
elif rand_A < 300 or rand_B > 300:
print("A or B is less that 100")
if rand_A < 300:
print("A is less than 300")
else:
print("B is less than 300")
else:
print("Neither is less than 100")