From bcfb3e8cabceac3c9e730d0115ef6f9709383860 Mon Sep 17 00:00:00 2001 From: Joshua Teves Date: Mon, 15 Mar 2021 16:05:09 -0400 Subject: [PATCH 1/2] Adds example --- data.txt | 1 + util.py | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 data.txt create mode 100644 util.py diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..172e882 --- /dev/null +++ b/data.txt @@ -0,0 +1 @@ +1 2 3 5 7 11 13 17 19 diff --git a/util.py b/util.py new file mode 100644 index 0000000..643a054 --- /dev/null +++ b/util.py @@ -0,0 +1,38 @@ +# Use Python to run this + +from os import listdir + +def ls(): + print(listdir('.')) +def run_my_analysis(option, data): + """Run my analysis.""" + print('Reading data') + with open('/Users/tevesjb/repositories/code-review-practice-1/data.txt', 'r') as f: + data = f.read() + print('Read the data') + nums = [] + numbers = data.split() + for n in numbers: + nums.append(int(n)) + print('Checking data...') + for n in nums: + if option == 'False': + if (n / 2) == 0: + print('%d: True' % n) + else: + print('%d: False' % n) + else: + # Checking to see if even + if (n/2) == 0: + print('%d: False' % n) + else: + print('%d: True'%n) + print('Finished aanalysing data!') + + + + +def main(): + run_my_analysis('True', '/Users/tevesjb/repositories/code-review-practice-1') +if __name__ == '__main__': + main() From 85ddf56258d63babc0bc120f3865818eaec76013 Mon Sep 17 00:00:00 2001 From: Joshua Teves Date: Tue, 16 Mar 2021 14:55:24 -0400 Subject: [PATCH 2/2] Update util.py --- util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util.py b/util.py index 643a054..caa8ece 100644 --- a/util.py +++ b/util.py @@ -1,4 +1,4 @@ -# Use Python to run this +#!/usr/bin/env python from os import listdir