Snippets Collections
keys, values)) # {'a': 2, 'c': 4, 'b': 3}
 
 
#make a function: def is the keyword for the function:
def to_dictionary(keys, values):
 
 
#return is the keyword that tells program that function has to return value   
return dict(zip(keys, values))
 
  
 
# keys and values are the lists:
 
keys = ["a", "b", "c"]   
 
values = [2, 3, 4]
                                
                                
# a characters list
          1.characters = ['a', 'b', 'c', 'd', 'e', 'f']
          2.characters.clear()
                                
                                
# animals list
1.animals = ['cat', 'dog', 'rabbit']

# list of wild animals
2.wild_animals = ['tiger', 'fox']

# appending wild_animals list to the animals list
3.animals.append(wild_animals)

4.print('Updated animals list: ', animals)                                
                                
 Lucky_numbers = [“3”, “7”, “15”, “32”, “42”]                               
                                
# animals list
1.animals = ['cat', 'dog', 'rabbit', 'guinea pig']

# 'rabbit' is removed
2.animals.remove('rabbit')

# Updated animals List
3.print('Updated animals list: ', animals)
ol li {
	 list-style-type: none;
     }
     
// OR

li {
	list-style-type: none;
}
def unfold(fn, seed):
  def fn_generator(val):
    while True: 
      val = fn(val[1])
      if val == False: break
      yield val[0]
  return [i for i in fn_generator([None, seed])]
  
  
EXAMPLES
f = lambda n: False if n > 50 else [-n, n + 10]
unfold(f, 10) # [-10, -20, -30, -40, -50]
bookmark
dashboard

Tue Apr 21 2020 11:45:29 GMT+0000 (UTC) https://towardsdatascience.com/30-helpful-python-snippets-that-you-can-learn-in-30-seconds-or-less-69bb49204172

#python #python #lists #dictionary
bookmark
dashboard

Tue Apr 21 2020 06:34:03 GMT+0000 (UTC) https://learnandlearn.com/python-programming/python-reference/python-remove-list-all-items-clear-function-with-examples

#python #python #lists #clear #remove
bookmark
dashboard

Tue Apr 21 2020 06:29:54 GMT+0000 (UTC) https://www.programiz.com/python-programming/methods/list/append

#python #python #lists #add
bookmark
dashboard

Tue Apr 21 2020 06:18:35 GMT+0000 (UTC) .https://www.youtube.com/watch?v=rfscVS0vtbw&t=5s

#python #python #lists
bookmark
dashboard

Tue Mar 31 2020 05:21:34 GMT+0000 (UTC) https://www.programiz.com/python-programming/methods/list/remove

#python #python #remove #lists
bookmark
dashboard

Wed Jan 22 2020 08:08:03 GMT+0000 (UTC)

#css #changingdefault #lists
bookmark
dashboard

Fri Jan 10 2020 19:00:00 GMT+0000 (UTC) https://www.30secondsofcode.org/python/s/unfold/

#python #lists #function

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension