Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am s3ctur on github.
  • I am s3ctur (https://keybase.io/s3ctur) on keybase.
  • I have a public key ASCS189l0NTTfJz9X9MdofcLUrhDgHXP7Q-nm_1W6oWzyAo

To claim this, I am signing this object:

@s3ctur
s3ctur / lesson7sol.py
Created May 22, 2017 06:41
Practice Python - Lesson 7 Solution
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]; b = list(filter(lambda x: x % 2 == 0, a)); print(b)
@s3ctur
s3ctur / lesson6sol.py
Created May 22, 2017 03:07
Practice Python - Lesson 6 Solution
def getPal():
x = input('Please enter a word to check if it is a palindrome: ')
y = list(x)
z = list(reversed(y))
if z == y:
print(str(x) + ' is a palindrome.')
else:
print(str(x) + ' is not a palindrome.')
@s3ctur
s3ctur / lesson4sol.py
Created May 20, 2017 08:16
Practice Python - Lesson 4 Solution
x = range(1, 101)
y = []
foo = int(input('Please choose a number between 1-100: '))
for elem in x:
if elem % foo == 0:
y.append(elem)
print(('Out of 100, the following numbers are divisors for ') + str(foo) + (': ') + str(y))
@s3ctur
s3ctur / lesson3sol.py
Created May 20, 2017 08:15
Practice Python - Lesson 3 Solution
##a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
##b = []
##for element in a:
## if element <= 5:
## b.append(element)
##print(b)
##foo = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]; b = list(filter(lambda x: x <= 5, foo)); print(b)
@s3ctur
s3ctur / lesson2sol.py
Created May 20, 2017 08:14
Practice Python - Lesson 2 Solution
#!/usr/local/bin/python3
number = input("Please enter a number ")
evenodd = int(number) % 2
if int(evenodd) == 0:
print(str(number) + " is an even number.")
else:
print(str(number) + " is an uneven number")
@s3ctur
s3ctur / lesson5sol.py
Created May 20, 2017 08:07
Practice Python - Lesson 5 Solution
##a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
##b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
##c = set(a).intersection(b)
##print(c)
import random
samp = []
def getSamp():