a = [1,2,3,4,5,6,7,8,9,10]
list(map(lambda x: x*2, a))
nums = range(-5,5)
odds = list(filter(lambda x: x % 2 == 1, nums))
print(odds)
add = lambda x,y: x + y
print(add(10,5))
from hashlib import *
h8 = sha256("hello".encode('utf-8'))
print(h8.name)
print(h8.block_size)
print(h8.hexdigest())
print(h8.digest_size)
h16 = sha256("hello".encode('utf-16'))
print(h16.name)
print(h16.block_size)
print(h16.hexdigest())
print(h16.digest_size)
with open('testfile.txt','r') as f:
testfile = f.read()
with open('testfile2.txt','r') as f:
testfile2 = f.read()
testfile.encode('utf-8')
hashFile = sha256(testfile.encode('utf-8'))
print(hashFile.hexdigest())
testfile.encode('utf-8')
hashFile = sha256(testfile2.encode('utf-8'))
print(hashFile.hexdigest())
def test_var_args(f_arg, *argv):
print('first normal arg: ', f_arg)
for arg in argv:
print('another arg through *argv:', arg)
test_var_args('nick', 'argshere', 12345, 'works w/ numbers')
def say_hi(**kwargs):
for k,v in kwargs.items():
print('{0} = {1}'.format(k,v))
say_hi(name="nikoli", age=30, hi=99)
def test_args_kwargs(arg1, arg2, arg3):
print('arg1:', arg1)
print('arg2:', arg2)
print('arg3:', arg3)
tup = ('two',3,5)
kwargs = {"arg3":3,"arg2":"two","arg1":5}
test_args_kwargs(*tup)
print('---')
test_args_kwargs(**kwargs)