You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

362 KiB

introduction of myself

creating a set of permutative identities from two lists the example of a mario meme is also used

In [18]:
adj_l = ["speculative","productive","playful","historical","interdependent"]
role_l = ["programmer","archivist","publisher"]
In [19]:
# utilities to check word starts with a vowel 
# given a string, check the first item in the string, if it is any of a e i o u, then it starts with vowel

def isVowel(str):
    vowels = ["a","e","i","o","u"]
    first_l = str[0]
    #try not to use the iterative method 
    # found method on stackoverflow using the "any" function 
    return any(str[0] in vowel for vowel in vowels)
In [20]:
counter = 0
print("onebigear is: ")

print_out = ""
print_out_l = []

# loop over the items in the two lists in permutations, use nested for loop
for adj in adj_l:
    for role in role_l:
        counter = counter + 1
        if isVowel(adj) is True:
            # for precision, if the adj starts with a vowel, should print the indefinite article 'an'
            print_out = str(counter) + ". " + "an " + adj + " " + role
            # append print out to a new list 
            print_out_l.append(print_out)
            print("{}. an {} {}".format(counter,adj,role))
        else:
            print_out = str(counter) + ". " + "a " + adj + " " + role
            print_out_l.append(print_out)
            print("{}. a {} {}".format(counter,adj,role))

print("printing file list {}".format(print_out_l))
onebigear is: 
1. a speculative programmer
2. a speculative archivist
3. a speculative publisher
4. a productive programmer
5. a productive archivist
6. a productive publisher
7. a playful programmer
8. a playful archivist
9. a playful publisher
10. a historical programmer
11. a historical archivist
12. a historical publisher
13. an interdependent programmer
14. an interdependent archivist
15. an interdependent publisher
printing file list ['1. a speculative programmer', '2. a speculative archivist', '3. a speculative publisher', '4. a productive programmer', '5. a productive archivist', '6. a productive publisher', '7. a playful programmer', '8. a playful archivist', '9. a playful publisher', '10. a historical programmer', '11. a historical archivist', '12. a historical publisher', '13. an interdependent programmer', '14. an interdependent archivist', '15. an interdependent publisher']
In [21]:
# shuffle the list for fun 
import random 
random.shuffle(print_out_l)
print(print_out_l)
['12. a historical publisher', '11. a historical archivist', '7. a playful programmer', '14. an interdependent archivist', '8. a playful archivist', '10. a historical programmer', '13. an interdependent programmer', '6. a productive publisher', '15. an interdependent publisher', '9. a playful publisher', '3. a speculative publisher', '4. a productive programmer', '2. a speculative archivist', '1. a speculative programmer', '5. a productive archivist']
In [22]:
#rewrite the function with a name called identity shuffler
# supply the function with your own lists of content and ponder upon these identities 
# sample code for mario character

import matplotlib.pyplot as plt
from matplotlib.pyplot import figure

figure(num=None,figsize=(50,50),dpi=15,facecolor='w',edgecolor='k')
im = plt.imread('mario_diversity.JPG')
plt.imshow(im) 
Out[22]:
<matplotlib.image.AxesImage at 0x7f0ab8e3d850>
In [23]:
# names, descriptives and identities 
name = "mario"
adj_l = ["strategic","reflective","implicated"]
role_l = ["gamer","plumber"]


def identity_shuffler(name, adj_l,role_l):
    # vars 
    counter = 0
    
    print("{} is: ".format(name))

    print_out = ""
    print_out_l = []
    
    # loop over the items in the two lists in permutations, use nested for loop
    for adj in adj_l:
        for role in role_l:
            counter = counter + 1
            if isVowel(adj) is True:
                # for precision, if the adj starts with a vowel, should print the indefinite article 'an'
                print_out = str(counter) + ". " + "an " + adj + " " + role
                # append print out to a new list 
                print_out_l.append(print_out)
                print("{}. an {} {}".format(counter,adj,role))
            else:
                print_out = str(counter) + ". " + "a " + adj + " " + role
                print_out_l.append(print_out)
                print("{}. a {} {}".format(counter,adj,role))

    print("printing file list {}".format(print_out_l))    
In [24]:
identity_shuffler(name,adj_l,role_l)
mario is: 
1. a strategic gamer
2. a strategic plumber
3. a reflective gamer
4. a reflective plumber
5. an implicated gamer
6. an implicated plumber
printing file list ['1. a strategic gamer', '2. a strategic plumber', '3. a reflective gamer', '4. a reflective plumber', '5. an implicated gamer', '6. an implicated plumber']
In [ ]: