Skip to content

Instantly share code, notes, and snippets.

@popey456963
popey456963 / reversedna.py
Created November 4, 2015 18:52
Reverse DNA
dna = input()
out = ""
for i in dna:
if i == "A":out+="T"
if i == "C":out+="G"
if i == "G":out+="C"
if i == "T":out+="A"
print(out)
@popey456963
popey456963 / countingDNA.py
Created November 4, 2015 18:46
Counting DNA
s=input()
a=s.count("A")
b=s.count("C")
c=s.count("G")
d=s.count("T")
print(str(a) + " " + str(b) + " " + str(c) + " " + str(d))
@popey456963
popey456963 / invertcase.py
Created November 4, 2015 18:23
Invert Case
print(''.join(c.lower() if c.isupper() else c.upper() for c in input()))
@popey456963
popey456963 / stepping.py
Created November 4, 2015 18:15
Stepping Stones
import math
start = int(input())
end = int(input())
amount = int(input()) - 1
if amount == -1 and start == 0 and end == 0:
print("NONE")
else:
difference = end-start
step = difference/amount
@popey456963
popey456963 / ascii.py
Created November 4, 2015 13:33
Ascii Transformer
line = input()
if len(line)%3 == 0:
n=3
c=""
for i in [line[i:i+n] for i in range(0, len(line), n)]:
c+=chr(int(i))
print(c)
else:
print("ERROR")
@popey456963
popey456963 / dataUnencryption.py
Created November 4, 2015 11:37
Data UnCompression
p,a,c="n",[],""
for i in "2ab4g9cat":
if i in "0123456789":
if p=="n":c+=i
else:a.append(c);c,p=""+i,"n"
else:
if p=="a":c+=i
else:a.append(c);c,p=""+i,"a"
a.append(c)
@popey456963
popey456963 / dataEncryption.py
Created November 4, 2015 11:30
Data Compression
past=""
amount = 0
n = input()
past=n[0]
system = []
for i in n:
if i == past:
amount+=1
else:
system.append(str(amount) + past)
@popey456963
popey456963 / suminput.py
Created November 2, 2015 21:02
Summing Input
input();print(sum([int(i)**2 for i in input().split()]))
@popey456963
popey456963 / eggs.py
Created November 2, 2015 20:30
Buying Eggs
print(min(int(input()),int(input())))
@popey456963
popey456963 / doublewords.py
Created October 31, 2015 13:06
Double Words
double=0
for i in input().split():
past = ""
for char in i:
if char.lower() == past.lower():
double+=1
break
else:
past = char
print(double)