コード例 #1
0
import prime

answer = prime.checkIfPrime(13)
print(answer)
'''
If the imported python script (in this case prime.py) is in a separate folder
Then follow should be added at the top of the script
import sys
if '<path to modules folder>' not in sys.path:
    sys.path.append('<path to modules folder>')
'''
コード例 #2
0
ファイル: use_check_prime.py プロジェクト: dvjr22/Learning
# Python3

# import system and add path to import modules
# Only need to do this if not in same folder
import sys
if '/home/valdeslab/LearningPython/PythonModules' not in sys.path:
	sys.path.append('/home/valdeslab/LearningPython/PythonModules')

# import module 
import prime

# do stuff w/ module
answer = prime.checkIfPrime(54)
print (answer)

print (prime.checkIfPrime(13))
コード例 #3
0
def main():
  answer = prime.checkIfPrime(13)
  print(answer)
コード例 #4
0
ファイル: checkIfPrime.py プロジェクト: YeelerG/pyTestCode
from prime import checkIfPrime

try:
    num = int(input("Please input a number: "))
    print(checkIfPrime(num))
except ValueError:
    print("It is not a number.")
except Exception as e:
    print("Unknown error: ", e)

# print sys.path
コード例 #5
0
#This doesn't work properly, needs some revision later

import sys
if '/Users/cherry/Desktop/repos/turtles-doing-things/misc/modules' not in sys.path:
    sys.path.append('/Users/cherry/Desktop/repos/turtles-doing-things/misc/modules')
    
import prime

numberToCheck = int(input('Please enter a number: '))
answer = prime.checkIfPrime(numberToCheck)
print(answer)

answer = prime.checkIfPrime(numberToCheck)
print(answer)


コード例 #6
0
import prime
import sys

if '/usr/rachel' not in sys.path:
	sys.path.append('usr/rachel')
answer = prime.checkIfPrime(13)
print (answer)