Skip to content

Instantly share code, notes, and snippets.

@popey456963
popey456963 / summing.py
Created October 24, 2015 18:30
Summing All Inputs
tot = 0
for i in range(int(input())):
tot = tot + int(input())
print(tot)
@popey456963
popey456963 / removingduplicates.py
Created October 24, 2015 18:53
Removing Duplicates
l=[]
for i in range(int(input())):l.append(input())
y = [x for i,x in enumerate(l) if x not in l[:i]]
for i in y:print(i)
@popey456963
popey456963 / sequences.py
Created October 24, 2015 19:01
Sequences
x = input().split(" ")
y = []
for i in range(int(x[0])):
y.append(i*int(x[1]))
out = ""
for i in y:
out = out + str(i)
out = out + " "
print(out[:-1])
@popey456963
popey456963 / letters.py
Created October 24, 2015 19:22
Detecting Letters
m = input()
if "o" in m or "O" in m:
print("true")
else:
print("false")
@popey456963
popey456963 / cdxminifier.py
Created October 24, 2015 19:47
Minifying CDX
n = int(input())
a = []
for i in range(n):
a.append(input())
b = "".join(a)
c = b.split("'")
data = ""
for key,val in enumerate(c):
if key % 2 == 0:
data+="".join(val.split())
@popey456963
popey456963 / mining.py
Created October 24, 2015 22:55
SpaceShips
site_count = int(input())
couple_count = int(input())
names = input().split()
ids = input().split()
minerals = input().split()
data = []
for i in range(couple_count):
data.append(input().split())
@popey456963
popey456963 / reverseword.py
Created October 25, 2015 11:14
Reverse Words
s = input().split(" ")
a = []
for i in s:
a.append(i[::-1])
print(" ".join(a))
@popey456963
popey456963 / leapyear.py
Created October 25, 2015 11:28
Leap Year
if n%400==0:print("true")
elif n%100==0:print("false")
elif n%4==0:print("true")
else:print("false")
@popey456963
popey456963 / anagrams.py
Created October 25, 2015 16:18
Testing Anagrams
s1, s2 = input().split(" ")
if sorted(s1) == sorted(s2): print("Anagram")
else: print("Not Anagram")
@popey456963
popey456963 / oddoneout.py
Created October 25, 2015 16:27
Odd One Out
numbers = input().split(" ")
j = []
for i in numbers:
j.append(int(i))
count = 0
for i in j:
if i < 0:
count = count - 1
else:
count = count + 1