• Check for Uniqueness in Python List: This method can be used to check if there are duplicate items in a given list [ Top list is “True” (Has Duplicate) | Bottom list is False ]

def all_unique(lst):

  return len(lst) == len(set(lst))

y = [1,2,3,4,5,6,6,7,8,9,9,]

x = [11,12,13,14,15,16,17,18,19]

print(all_unique(x))

print(all_unique(y))

#

#END

  • Memory Usage: This can be used to check the memory usage of an object

import sys

variable = 69

print(sys.getsizeof(variable))

#

#END

  • Print the String n Multiple Times: Print can display a snippet multiple times w/out using a loop

n = 2;

s = ‘Bitcoin ‘

print(s*n);

# OR

print(‘Ethereum ‘*2)

#

#END

  • Convert First Letters of Words to Uppercase: – –   title( )

k = ‘by: kalistamp all day every day’

print(k.title())

#

#END

  • Convert First Letters of Words to Lowercase: – –   lower( )

k = ‘By: KAlistamp All Day Every Day’

print(k.lower())

#

#END

  • Count Lists: Check and finish this

array = [[‘a’, ‘b’], [‘c’, ‘d’], [‘e’, ‘f’]]

transposed = zip(*array)

[print(i) for i in transposed]

#

#END

  • Convert a List of Strings: Convert list into one single string, separated by commas

menu = [‘ipa’, ‘pilsner’, ‘hazy’, ‘coors’, ‘bud’, ‘wata’, ‘cola’, ‘sprite.lime’]

print(f’Hello\n The menu today is: \n’)

print(‘, ‘.join(menu))

#

#END

  • Difference Function: Find the difference between the two iterations (lists)  – – difference( )

# This can be good for finding duplicates in a Combo for example