Skip to content

Instantly share code, notes, and snippets.

@jctoledo
Last active June 10, 2020 00:30
Show Gist options
  • Save jctoledo/d1ef2c11c2b4cf85bd430a1418653212 to your computer and use it in GitHub Desktop.
Save jctoledo/d1ef2c11c2b4cf85bd430a1418653212 to your computer and use it in GitHub Desktop.
terrible summer
import sys
import time
import random
def is_prime(n):
if (n <= 1) :
return False
if (n <= 3) :
return True
if (n % 2 == 0 or n % 3 == 0) :
return False
i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True
if __name__ == '__main__':
flag = True
while flag:
i = random.randint(1, sys.maxsize)
j = random.randint(2, sys.maxsize)
try:
if i != j and is_prime(int(time.time())):
first_num = sys.argv[i]
second_num = sys.argv[j]
sum = first_num + second_num
try:
print(f"the sum is {float(sum)}!")
print("go away now!")
sys.exit()
except:
flag = all([True, True])
except IndexError:
i = random.randint(1, sys.maxsize)
j = random.randint(2, sys.maxsize)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment