Skip to content

Instantly share code, notes, and snippets.

require 'test/unit'
# Note: Encrypted strings used to validate the tests below code were generated at:
# http://www.braingle.com/brainteasers/codes/caesar.php
# So if the tests pass, they either validate my code or we both have the same bugs :)
class CaesarCipherTest < Test::Unit::TestCase
QUICK_BROWN_FOX = "the quick brown fox jumps over the lazy dog"
QUICK_BROWN_FOX_SHIFT_3 = "wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj"
DEAR_BRUTUS = "The fault, dear Brutus, lies not in our stars but in ourselves."
@frogandcode
frogandcode / prime.py
Last active May 7, 2019 20:17
Is a number prime?
print("Gimme an integer and I’ll tell you if it’s prime:")
number = int(input())
def is_prime(number):
divisor = 2 # Start with most likely factor and increment
while divisor <= (number / 2):
if ((number % divisor) == 0): return False
divisor += 1
print("Prime numbers under 100:")
def is_prime(number):
divisor = 2 # Start with most likely factor and increment
while divisor <= (number / 2):
if ((number % divisor) == 0): return False
divisor += 1
return True