#ListOfLists
Explore tagged Tumblr posts
pocaispoca · 3 years ago
Text
Lists
(MITx-6.00.1x)
-- Lists are Python objects.
-- Lists are created using square brackets: L = [ 1, 15, 7]
-- List items can be of any data type but usually homogeneous.
-- The big difference between tuple and list is, list is mutable.
-- To make a list using list() :
lst = list()    or   lst = [ ]  #Making an empty list.
lst = list( (“a”, “b”, “z”))   # Making a list, with double round-brackets.
or we can create lists using square-brackets:
lst = [”a”, “b”, “z”]
-- add elements to end of list  -- L.append(element)
-- to combine lists together use concenation,  + operator --  L1 + L2
-- mutate list with --  L.extend(some_list)
-- delete element at a specific index -- del(L[index])
-- remove the last element of list -- L.pop()
-- remove a specific element -- L.remove(element)
-- * string to list -- list(string) #returns a list with every character from a string
--to split a string on a character parameter -- s.split(’char’)
--to turn a list of characters into a string -- ‘ ‘.join(L)
-- create a new list clonning an other list -- Lclone = L[ : ]
ex.:
L = [’a’, ‘b’, ‘c’]  -- ‘ ‘.join(L) -- returns “abc” or ‘_’.join(L) -- returns “a_b_c”
-- sort a list(mutated) -- L.sort()
--sort a list(not mutated) -- sorted(L)
-to reverse a list -- L.reverse() -- mutates L 
** we can make list of lists.  -- listoflists = [L , L1 , L2,] or  lol = [[1,2],[’a’,’b’,’c’],[1.2.3.4.5.0]] or append a list -- lol.append([4, 5])
--to insert an element to desired index -- list.insert(i, element)
EX 1:
--avoid mutating a list as you are iterating over it , before iteration, clone it:
def remove_dups_new(L1, L2):    L1_copy = L1[:]    for e in L1_copy:     if e in L2:         L1.remove(e) L1 = [1, 2, 3, 4] L2 = [1, 2, 5, 6]
remove_dups_new(L1, L2) print(L1)
EX 2:
def applyToEach(L, f): 
    for i in range(len(L)):
         L[i] = f(L[i]) 
L = [1, -2, 3.4]
applyToEach(L, abs)      #[1, 2, 3.4] Apply absolute to each element of the list.
applyToEach(L, int)        #[1, 2, 3]  Apply int to each element of the list.
applyToEach(L, fact)      #[1, 2, 6]  Apply factoriel to each element of the list.
applyToEach(L, fib)        #[1, 2, 13]  Apply fibonacci to each element of the list.
EX 3:
def applyFuns(L, x):
    for f in L: 
        print(f(x))
applyFuns([abs, int, fact, fib], 4)
4, 4, 24, 5
#We have a list of functions and we are applying this list to an integer.
HOP, map
** simple form – a unary function and a collection of suitable arguments
 ◦ map(abs, [1, -2, 3, -4])
** produces an ‘iterable’, so need to walk down it 
for elt in map(abs, [1, -2, 3, -4]): 
    print(elt)
 1, 2, 3, 4
** general form – an n-ary function and n collections of arguments 
◦ L1 = [1, 28, 36] 
◦ L2 = [2, 57, 9] 
for elt in map(min, L1, L2): 
    print(elt)
 1, 28, 9
1 note · View note
swiftkind · 8 years ago
Text
Adding items to JavaScript arrays
Author: Kev Kalis
The JavaScript .push() function
array.push() is a built-in function to the javascript array prototype. It is used to add items to the end of a list.
let drinks = ['juice', 'cola', 'milk'];
Let's say that you have a list of drinks on your restaurant's menu. While you were in your kitchen, you accidentally discovered a new revolutionary drink called 'chocolate'!
Now, you want to add it to your list of drinks. array.push() can help you with that!
let drinks = ['juice', 'cola', 'milk']; drinks.push('chocolate'); console.log(drinks) // ['juice', 'cola', 'milk', 'chocolate']
You now have chocolate in your drinks list.
Other examples
Strings are not the only types of data that can be used with the push() function
Number
let mondays = [6, 13]; mondays.push(20); console.log(mondays); // [6, 13, 20]
Array
let listOfLists = [ ['banana', 'apple', 'grapes'], ['legumes', 'cabbage'] ]; listOfLists.push(['guitar', 'bass', 'drums']); console.log(listOfLists); // [ // ['banana', 'apple', 'grapes'], // ['legumes', 'cabbage'], // ['guitar', 'bass', 'drums'] // ]
Object
let cats = [ { breed: 'Persian', color: 'gray' } ]; cats.push({ breed: 'Scottish Fold', color: 'white' }); console.log(cats); // [ // { // breed: 'Persian', // color: 'gray' // }, // { // breed: 'Scottish Fold', // color: 'white' // } // ]
These examples are just the basic use-cases for array.push(). Every programmer will certainly encounter problems related to lists, and adding items to them will surely be one of them.
0 notes
phorlaville · 12 years ago
Text
List of lists - Sharepoint 2013
Bon. La problématique : Lister sur la home page d'un site sharepoint 2013 la liste des listes de type "Survey", avec un lien vers ces listes.
Après avoir farfouillé du côté des webpart sans succès j'ai décidé de faire ça avec le designer..
Le datasource : <SharePointWebControls:SPDataSource     ID="SPDataSource1"     runat="server"     DataSourceMode="Listoflists"> </SharePointWebControls:SPDataSource>
Rien de bien sorcier... http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spdatasource.datasourcemode.aspx http://solutionizing.net/spdatasource-fields-for-webs-listsoflists/
La grid :
<asp:GridView     ID="GridView1"     runat="server"     DataSourceID="SPDataSource1"     AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" PageSize="2000" CellPadding="3" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Left" EnableSortingAndPagingCallbacks="True">     <Columns>         <asp:boundfield DataField="__spBaseTemplate" HeaderText="Survey Type">         </asp:boundfield>         <asp:hyperlinkfield DataNavigateUrlFields="__spDefaultViewUrl" DataTextField="__spTitle" HeaderText="Survey Name">         </asp:hyperlinkfield>         <asp:boundfield DataField="__spCreated" HeaderText="Survey Date">         </asp:boundfield>         <asp:boundfield DataField="__spAuthor" HeaderText="Survey Author">         </asp:boundfield>     </Columns> </asp:GridView>
Ça donne ça :
Tumblr media
Le problème : pour filtrer et ordonner les spdatasources, on se sert généralement d'une CAML Query.
Je recommande vivement ce petit outil : CAML Designer
ça devrait donner ça pour le SPDatasource :
<SharePoint:SPDataSource     ID="SPDataSource1"     runat="server"     DataSourceMode="Listoflists"     SelectCommand="<View><ViewFields><FieldRef Name='__spTitle'/><FieldRef Name='__spCreated'/><FieldRef Name='__spBaseTemplate'/><FieldRef Name='__spDefaultViewUrl'/></ViewFields><Query><OrderBy><FieldRef Name='Created' /></OrderBy><Where><Eq><FieldRef Name='__spBaseTemplate' /><Value Type='Text'>Survey</Value></Eq></Where></Query></View>"> </SharePoint:SPDataSource>
Et bien non.... le selectcommand n'est absolument pas pris en compte pour le mode Listoflist...
Résultat : j'obtiens bien une liste de mes listes. De toutes mes listes, non filtrées et non triées par date de création...
Pour le filtrage sur le type "Survey", je fais ça en jQuery : je masque la ligne (TR) si le contenu de la 1ere colonne est "Survey", après avoir créé un div avec id pour englober ma grid. J'en profite pour mettre un peu en forme et masquer la 1ere colonne (type de liste) :
<SharePointWebControls:SPDataSource     ID="SPDataSource1"     runat="server"     DataSourceMode="Listoflists" UseServerDataFormat="True"> </SharePointWebControls:SPDataSource> <div id="surveylist" style="display:none;"> <asp:GridView     ID="GridView1"     runat="server"     DataSourceID="SPDataSource1"     AutoGenerateColumns="False" AllowSorting="True" AllowPaging="True" PageSize="2000" CellPadding="3" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Left" EnableSortingAndPagingCallbacks="True">     <Columns>         <asp:boundfield DataField="__spBaseTemplate" HeaderText="Survey Type">         </asp:boundfield>         <asp:hyperlinkfield DataNavigateUrlFields="__spDefaultViewUrl" DataTextField="__spTitle" HeaderText="Survey Name">         </asp:hyperlinkfield>         <asp:boundfield DataField="__spCreated" HeaderText="Survey Date">         </asp:boundfield>         <asp:boundfield DataField="__spAuthor" HeaderText="Survey Author">         </asp:boundfield>     </Columns> </asp:GridView> </div> <script type="text/javascript"> $(document).ready(function() {   $("tr th:first-child").hide();   $("tr td:first-child").hide();   $("tr td:first-child:not(:contains('Survey'))").closest('tr').hide();   $("#surveylist th").css('text-align','left');   $("#surveylist").show(); }); </script>
Ça donne ça :
Tumblr media
Si jamais quelqu'un a une solution plus "propre", je suis preneur :)
0 notes
urasaru · 12 years ago
Link
"Geographies of Change is an online participative archive. Created as a web platform, it is intended to be an open and ongoing project. It is a user-maintained web-resource: every single person is invited to draw attention to activities that prioritize values such as wellbeing, sustainability and social justice. These projects all challenge the actual world through theory, collective participation or individual action. They stand out for their artistic look, economic proposal or social commitment."
0 notes
platformsoptional-blog · 12 years ago
Text
More SXSW Lists
Another list of Next Big Thing companies from SXSW. Some of them actually have vowels in their names. Most of them aren't apps, which is kind of refreshing.
0 notes
grailbot143 · 3 years ago
Photo
Tumblr media
Heya Anonymous
I have no idea when I said this or in what context. I absolutely know he has super human strength.
I'm sure it was funny for me in the moment though!
Thanks for the list!
2 notes · View notes
aparnakher · 5 years ago
Photo
Tumblr media
Another list of lists you should make right now! 1. A list of quotes/ mindsets that you really resonate with 2. A packing list/ every day carry or EDC list 3. A list of things to check before you leave the house! Which of these lists are you going to add to your collection? Let me know in the comments below! If you want a list of all 8 lists you can make, check out my video and blog. Links in bio! #saveourselves #saveourselvesblog #weeklyvideo #indianyoutuber #indiancontentcreator #indianblogger #femaleyoutuber #femaleblogger #femalecontentcreator #listsyoushouldmake #listoflists #alistoflists #liststomake #maketheselists #listmaking #listobsessed #listobsession #makebetterlists #makeyourlist https://www.instagram.com/p/CHcn7srBRTT/?igshid=177cwy49xd0g6
0 notes
grailbot143 · 3 years ago
Photo
Tumblr media
I love that song.
Ending
So. . . that was an alright episode. Nothing to write home about. Just so-so. Not really my type of jam. Mostly adequate. Garden variety. Kinda forgettable, honestly. Maybe a 5 out of 10?
Okay, okay. It was slightly better than all that.
It was great! I love the music. I love the relationships. I loved seeing all the new fusions. I loved the White Diamond arc. . . which basically all took place in this one episode. I love that Yellow and Blue were so completely swayed by Steven's amazing arguments for policy updates.
I loved Connie.
I enjoyed Bismuth, Lapis, and especially Peridot in their very small but important parts.
I laughed, I teared up, I googled some stuff, I got angry, and I . . . didn't learn anything? hm. I feel like that last part's not right, but I can't think of what it might have been.
I learned to go to an adult if I'm being bullied and to not try to make my hands into suction cups at home.
So, easy 10 out of 10.
This wrapped up everything to be the end of the show so neatly. It's almost a shame to continue.
Except. . .
A zoo of humans somewhere out in space doing who knows what
Enemies such as Jasper who probably need further dealing with
The chest in Lion's mane
We still don't know where Gems originally came from. . .
Why is Homeworld cracked in half?
We still don't know what the hell Onion's deal is
Sugilite is still benched. Would they fit better together now that they've gone through all these changes or. . .
What happened to the hands on the temple?
And, most importantly, WHY DID THEY PUT THOSE CUPCAKES IN THOSE JARS?
Dang, I guess we'll have to keep watching. Hopefully all of these will be answered by the end of this. Especially that last one.
15 notes · View notes
grailbot143 · 3 years ago
Photo
Tumblr media
Also, let's look for a moment at all the pictures and knick knacks.
We have:
the conch
a recent painting of all four of them (maybe from Vidalia)
the t-shirt cannon
aviators
a cool vase of flowers
Rose's broken sword
a record player
some books or dvds or cassettes
baseball and glove
A Game
Conquerors of Eldermore
a GameCube controller
a photo of the bay
a photo of their temple
a photo of the barn
3 notes · View notes
grailbot143 · 3 years ago
Photo
Tumblr media
Nice Shop. And really great prices. Or maybe inflation has been even worse than I thought.
I see:
Croissant Moon (I love (well made) croissants. They are like heaven in your mouth)
Black Donut Holes (I don't eat black pastries, but I think Black Holes are awesome.)
Galileo Gallette (yum)
Chocolate Ship Cookies (I was going to make some of those tomorrow.)
Oortmeal Raisin Cookies (also making those. . . theoretically)
Total Eclipse of the . . .
Red Dwarf Velvet Cake (yum yum)
Polvoron (maybe I'm an uncultured swine, but I don't know what that's supposed to be)
Cake Pops (very clever name)
Lars looks right at home here. Odd he didn't look so eager at the last pastry shop, the one that ordered premade donuts in boxes, you know.
6 notes · View notes
grailbot143 · 4 years ago
Photo
Tumblr media
Things that poofed ultimate soldier Jasper:
a pointy metal stick
Things that haven't poofed kindergartener Peridot:
a pile of rubble
an injector
a fall from a cliff
a boulder (over and over and over)
Steven's bubble
Should I continue this list?
25 notes · View notes
grailbot143 · 4 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Tentacole … Cellophane (which is legit worse than Scotch honestly) Tailman (I like the Martial Arts Hero) Sugarman ?? I don’t even know his power … this didn’t help ?? I personally preferred Ashido’s first name choice. Pinky is … ChargeBolt - sure, sure, Invisible Girl - the only one I got right.. . Creati - this is a very well picked name for her. I dig it. Grape Juice… rly? Anima - I don’t know his power, but I assumed it was animal related. I like Fluttershy better, but we’ll see.
8 notes · View notes
grailbot143 · 5 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Sugilite
Sugilite is a powerful fusion of Amethyst and Garnet. She is wild, uncouth, and wicked strong.
Weapon: Flail or "wrecking ball thingie"
Powers:
Hulk-like strength
Best Characteristics: Strong Worst Characteristic: loud, angry, rude, unapologetic
Character Design:
Sugilite is large with four muscular arms and very muscular legs. She has five eyes, sharp teeth, and thick dark hair. Her skin is pink. Her clothes are purple and black.
Her outfit is a tight fitting body suit with rips in the knees. Two of her arms are covered with holey sleeves while her other arms have black wrapped around ending at a cover over her middle finger. She also wears rad pointy sunglasses *or 'Kamina shades'*.
Seen In:
Coach Steven
Best Moment(s):
First meeting her
. . .
20 notes · View notes
grailbot143 · 5 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Stevonnie
Stevonnie is the fusion of Steven and Connie. They are a tall beautiful mostly human looking teenager. Their personality is innocent and unsure. They are the embodiment of puberty basically.
Weapon: don't know yet 
Powers: don't know yet
Best Characteristics: Innocence, Free Spirit 
Worst Characteristic: Anxiety
Character Design:
Stevonnie is a tall teenager with thick wavy dark hair, a feminine figure and proportions, and brown skin. They have a pink gem as a belly button. Their clothes are mid-thigh jean shorts, a red short shirt with a yellow star under a blue short tank top (It was a dress on Connie).
Seen In:
Alone Together
Best Moment(s):
Showing the Gems (Garnet's reaction :) )
Lars' reaction
Sadie's reaction
Basically. . . just everyone reacting
Dancing at the Rave
Standing up to Kevin, the jerk, at the rave (I totally remembered his name on my own . . . and did a little celebratory woohoo when SonBot told me I was right ^.^)
21 notes · View notes
grailbot143 · 5 years ago
Text
Retrospection Gone Mad
How did your opinions of Pearl change over the course of the season?
Honestly, my opinion of Pearl plummeted somewhere in the middle of the season, and was very barely repaired through to the end.
In the beginning of the show, I thought she was slightly neurotic and tremendously endearing. While I probably would have a hard time hanging out with such a 'A' Type personality that frets so much (or more like, she would have a hard time hanging out with me), I appreciate all the care and thought she put in to mothering. Plus, and normally this plus will get me over alot of character flaws, she's super intelligent and a science geek! How could you not love her.
But throughout the season she shows very little empathy for anyone or anything happening outside her immediate family. She is vain and shows a ridiculous amount of disdain for us humans. I might be able to forgive her that since I know that the whole reason she is here was because she cared so deeply for Rose that she was willing to fight a war with her (over a planet she obviously has no love for) and go into exile (on a planey she obviously has no love for) just to lose Rose to one of us mere mortals. But I'm not ready yet. She needs to be much more empathetic, much less self-involved and be far more badassy before forgiveness is offered.
What was your favorite Pearl-centric Episode?
Easy, Space Race
What was your most relatable Pearl moment?
Going through all that I could remember. . . it came down to a few, somewhat suprising moments. I really thought it'd have something to do with mothering Steven, but turns out she and I have less in common in parenting than in other characteristics.
In Shirt Club, she and the other Gems are building Ikea furniture. At the beginning, she is reading all the instructions. That's me and Ikea. Like our whole relationship. Then she built the stool and I didn't relate to her anymore I never get that far.
In House Guest, she fixes the van because she's the only one that can. Honestly, I'm often doing things I don't think I'm responsible for because I'm the "only one that can". To be fair though, Pearl might ACTUALLY be the only one, whereas, pretty much everyone around me pretends to not be able to do anything because they know I'll take care of it. Also, I've had SO MANY house guests that have overstayed. I appreciate her desire to keep her household as it is.
In FryBo (I was really trying to forget this one existed, but. . . ), she tells that story at the beginning about the Gem Shards. You know the story, the one about the infantries and all those deaths. If you don't know, that's because WE NEVER GOT TO HEAR THE STORY! But at the end when she's asking Steven if he remembers the story. Yea, been there. There often actually.
In Gem Glow when they tell Steven they stole all the Cookie Cats for him and then it is revealed that Pearl actually went back and paid for them. I have actually gone back in a store to pay for something that a friend accidentally carried out. No shame there. . . .
Favorite Pearl Power
Don't really have a favorite Pearl specific power. I guess summoning duct tape?
Favorite Pearl Scene
Gotta be when she donned a clown costume to cheer Steven up in So Many Birthdays
26 notes · View notes
grailbot143 · 5 years ago
Photo
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
Pearl
Of Steven's guardians, Pearl is the most matronly, in that she is a neurotic, hovering, caring, loving individual who acts on her worries for Steven's safety for than the other guardians in his life.
She is a graceful and limber fighter who uses swords. Her prowess with the sword is obvious. She is also intelligent and able to assess situations and create full plans in a matter of moments.
She is mostly cheerful, despite her worry, but her attitude toward the far less careful and less rigid Amethyst is often tumultuous. She often tries to leave Steven behind for his own safety and has been caught watching him sleep all night.
She has a tendency to be arrogant and self-centered and often her compassion does not extend outside her immediate family unit. She finds humans droll and insignificant.
Weapon: Spear Powers:
Holo-Pearl
Shapeshifting (shared)
Projections from Gem
Has healed in Gem (shared)
Controls Sand
Lasers from Spear
Best Characteristic: Science Nerd Worst Characteristic: Neurotic & Arrogant Character Design: Pearl is tall and thin with pale white skin. She sports a form-fitting outfit in pastel colors. Her head is an over-sized oval-sphere (is that a thing?) with a bird-like triangular nose. Her gem (the pearl) is fastened on her forehead. Her blond hair is in a ridiculous indescribable and unrealistic hairstyle. Best Moment(s): Discovering her meditation tree in Gem Glow Dresses up as a clown to cheer Steven up So Many Birthdays Teaching Steven to Fight with Swords Steven the Sword Fighter Geeking out about Shooting Star Monster Buddies Designing and Building a spaceship Space Race Helping Amethyst decipher her place in the world On the Run Sharing stories and feelings of Rose with Steven Rose's Scabbard
Relationships: Tumultuous relationship with Amethyst Looks up to Garnet Border-line? romantic feelings for Rose Disdain for Greg Known Fusions:
Alexandrite (all 3 Crystal Gems)
Opal (with Amethyst) Edited to correct fusion partner. . . Garnet was just wishful thinking
In school, she would probably be voted Most Likely To:
** Win a Nobel Peace Prize
24 notes · View notes