Skip to content

Instantly share code, notes, and snippets.

@popey456963
popey456963 / maxcount.py
Created October 25, 2015 22:28
Max Count
s=input().replace(" ","")
f={v:0 for v in s}
for c in s:f[c]+=1
print(max(f.values()))
@popey456963
popey456963 / ascii.py
Created October 26, 2015 13:07
Ascii Decoding
n = input()
characters = input()
character = characters.split(" ")
a = []
for i in character:
a.append(chr(int(i)))
print("".join(a))
@popey456963
popey456963 / asterisks
Created October 26, 2015 13:37
Illuminati
def asterix_triangle(i, t=0):
if i == 0:
return 0
else:
print((" " * n)[:-2] + ' ' * ( i + 1 ) + '*' * ( t * 2 + 1 ))
return asterix_triangle( i - 1, t + 1 )
def asterix_triangle2(i, t=0):
if i == 0:
return 0
@popey456963
popey456963 / hamming.py
Created October 26, 2015 13:45
Hamming Distance
f,s=input().split()
d=0
for i in range(len(f)):
if f[i]!=s[i]:d+=1
print(d)
@popey456963
popey456963 / sets.py
Created October 26, 2015 14:09
Categories and Sets
x=int(input())
for i in int(input()):
f,c,t=input().split()
if int(f)<=x<=int(c):print(t)
@popey456963
popey456963 / l33tspeaking.py
Created October 26, 2015 14:21
L33T Speak
n=input()
o={'A':'4','B':'8','C':'(','D':'|)','E':'3','F':'|=','G':'6','H':'|-|','I':'!','J':'_|','K':'|<','L':'1','M':'/\\/\\','N':'|\|','O':'0','P':'|>','Q':'9','R':'/2','S':'5','T':'7','U':'|_|','V':'\/','W':'\/\/','X':'}{','Y':'\'/','Z':'2'}
string=""
for i in n:
if i.upper() in o:
string+=o[i.upper()]
else:
string+=i
print(string)
@popey456963
popey456963 / doublewords.py
Created October 26, 2015 14:30
Double Words
past = ""
n = 0
for word in input().split(" "):
for letter in word:
if letter != " ":
if letter.lower() == past.lower():
n+=1
break
past = letter
past = ""
@popey456963
popey456963 / binaryconverter.py
Created October 26, 2015 15:17
Convert to Binary
for i in range(input()):print bin(input())[2:]
@popey456963
popey456963 / moresequences.py
Created October 26, 2015 15:24
More Sequences
a, b = [int(i) for i in input().split()]
n = int(input())
for i in range(n):
x = int(input())
print(x*a+b)
@popey456963
popey456963 / squaresofhashes.py
Created October 26, 2015 15:27
Squares of Hashes
n = int(input())
if n!= 1:
string = ""
for i in range(n):
string +="#"
print(string)
for i in range(n-2):
print('#'+ " "*(n-2) + "#")
print(string)
else: