Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am hwatwasthat on github.
  • I am hwatwasthat (https://keybase.io/hwatwasthat) on keybase.
  • I have a public key ASBumR85A8o2i5LqKQcOXGCCU0uvMmkRMCGzP_rgZKRxKQo

To claim this, I am signing this object:

@Hwatwasthat
Hwatwasthat / main.py
Created April 3, 2018 16:27
Divisors within a prime checking program created by Hwatwasthat - https://repl.it/@Hwatwasthat/Divisors-within-a-prime-checking-program
def divisors(Num):
#Ensure number is positive
if Num <= 0:
print("Number must be positive")
main()
#create range to work in
range_nums = range(1, Num)
#create list for all divisors
@Hwatwasthat
Hwatwasthat / Fibonacci.py
Created March 26, 2018 10:19
Fibonacci created by Hwatwasthat - https://repl.it/@Hwatwasthat/Fibonacci
import random
# function to generate required fibonacci sequence
def fibonacci(k):
# intiate counter
i = 1
# intiate list to iterate on
main_list = [0, 1]
word = input("In:")
sumof = 0
x = 0
for i in word:
if word[x] == "a" or word[x] == "e" or word[x] == "i" or word[x] == "o" or word[x] == "u":
sumof += 1
x += 1
print(sumof)
import random, time
k = 0
def sorted_list(a, b):
test = random.sample(range(a), b)
test.sort()
return test
def binary_search(sorter, num_find):
print (sorter)
import string, random
from collections import OrderedDict
from itertools import count
# creating numerically linked dictionaries to pull characters from
lower = OrderedDict(zip(count(1), string.ascii_lowercase))
upper = OrderedDict(zip(count(27), string.ascii_uppercase))
symbols = OrderedDict(zip(count(53), (string.punctuation)))
length = int(input("How many characters would you like in your password?"))
i = 0
@Hwatwasthat
Hwatwasthat / List no duplicates.py
Created February 22, 2018 11:10
List no duplicates created by Hwatwasthat - https://repl.it/@Hwatwasthat/List-no-duplicates
import random
list = []
i = 0
while i < 100:
list.append(random.randrange(1,40))
i += 1
# creating a list with no duplicates using a for loop
def list_no_duplicates(list):
# sorting list to make it pretty
@Hwatwasthat
Hwatwasthat / XOR two hex values.py
Created February 21, 2018 16:02
XOR two hex values created by Hwatwasthat - https://repl.it/@Hwatwasthat/XOR-two-hex-values
# Values entered must be hex encoded, preface with 0x if not already
def hex_xor(first, second):
result = (first ^ second)
return result
@Hwatwasthat
Hwatwasthat / XOR.py
Created February 21, 2018 15:13
Hex to base64 created by Hwatwasthat - https://repl.it/@Hwatwasthat/Hex-to-base64
import base64
def hex_to_base64(input):
result = bytearray.fromhex(input)
result = base64.b64encode(result)
result = str(result).strip("'b'")
return result
@Hwatwasthat
Hwatwasthat / Palindrome check.py
Created February 21, 2018 14:13
Palindrome check created by Hwatwasthat - https://repl.it/@Hwatwasthat/Palindrome-check
# Input from console for word to check
word = input("What would you like to check if its a Palindrome?")
#initialise variables
x = 0
reverse_word = ''
# loop over word until all letters are done
for i in word:
# increment counter
x += 1
# extend reverse_word with next letter from word (reversed)