Commit 2620b231 authored by Jørgen Lien Sellæg's avatar Jørgen Lien Sellæg
Browse files

add options for running with cpp or python

parent 127c6576
......@@ -3,6 +3,20 @@ path.append("./../../build")
from Prime import next_prime
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--python', action='store_true')
parser.add_argument('--cpp', action='store_true')
parser.add_argument('--opt_prime', type=int)
args = parser.parse_args()
if not args.cpp and not args.python :
print("Please add option --python or --cpp")
exit()
def is_prime(x):
if x < 2:
return False
......@@ -26,12 +40,14 @@ def py_next_prime(x):
def print_prime(prime):
print("Next prime is " + str(prime))
if not args.opt_prime:
prime = 1000000000
else:
prime = args.opt_prime
if args.python:
print_prime(py_next_prime(prime))
prime = 1000000000
# print_prime(py_next_prime(prime))
print_prime(next_prime(prime))
if args.cpp:
print_prime(next_prime(prime))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment