You have given two times But then again it comes only once So obviously said does not allow any duplicates inside it Now you can go ahead and add some new I’ll use inside the set So I’ll die Been s one dog ad Hello world Right Survived this new element And if I want to add more than one element it or single time then we’ve got this update method So I’ll type in S one dark upbeat and I’ll give it a list off values So while diaper.
Let’s see Sparta up on then I like in 1 23 Then I’ll give in Let’s see three plus 90 Then let me print out as one All right All of these elements are being added again You see that The order of these elements has not reserved it is random right So three plus 90 comes over here and then we’ve got 11 23 rates of the random is not it all preserved All right so we’re done with the basic data structures and bison which will basically do pull list dictionary and set So now we’re here under the Floo Control statements on then flew control statements will start with F statement.
In jail World you will come across a lot of situations But I don’t have to make a decision on the basis for condition So let’s see if this happens then you have to perform a selloff actions else You have to go home with different serial factions So let’s take this example To understand this pair up So let’s say it’s raining and you’d want to play football So if it’s raining then you can’t do anything and you just have to sit inside else So if it is actually not training then you can go out and play football So these are some of the real world situations which can actually be represented in programming with the help off if else statement So let’s go to Jupiter notebook and work with efforts.
Here I’ll create up to variables So given the value off 10 Toe E and I’ve given the value off 20 Toby on then let me check if the value of B is actually greater than the value off So f B is greater than E Then I want to print out b s greater than it So since this Standish in has Bean evaluated to prove Barris who Wendy is greater than 10 And since this is true this statement has been executed So we get be scarier than a let me actually flip it.
I order check off e s greater than be end of this evaluate stood through I will print out e s greater than be so Don’t get any result And that is because this condition has been evaluated Two falls And since this condition has been evaluated toe falls the statement has been skipped So this is where else close comes And so let me use tells over here Now I’ll type in f e s greater than be Then I’d want to print out ISS greater than be health I want to print out be this greater than hey right.
Here The first condition evaluates to false and that is why it escaped And then we given the else close and this condition sprinted B is greater than it Now let’s see if you have multiple conditions So if you have three numbers and reward check which is the creators are those three numbers So the sewer we would need if else if else So let me actually assign the values again So I’ll assign men to eat 22 bi on d ie Also assigned 30 to see So now we’re more a check of a is greater than be in a scarier than see.
I’ll type in f e s greater than be on DDE e s greedier than see and of this evaluates to drew I want to print out e S t Could he just and this evaluates to falls Then I’ll type in which stands for Elsa So I’ll give in the next hour of conditions over here so I’ll type in B is greater than e On Dhe B is greater than C and here I will print out B is the greatest to be as though greet dist And again if this values to falls I’ll find you put in l’s Andi I will print out See a CZ though Greediest So here are the final result S C is the greediest Now let’s understand this whole thing Probably.
First we come to the fair statement and then we check if he is greater than B and E is greater than C Barris a stent greed than 20 and 10 Creative and 30 So both of these are false and falls and falls would evaluate two falls And that is why I will skip the statement over here Then we’ll come toe else if and we’re checking If B is greater than it 20 is greater than 10 which is true Then we’ll check Is 20 greater than 30 which is actually falls.
So true and false will evaluate the falls And again this is kept and finally will come to else and will print out See is the greatest So that’s how we can work with F belts Now let’s use the F statement without pupil So let me create a few blow here So do you be one and let me give some values a be on DSI so I have created the stupid Now after this I wanna check of the element is present and the stupid So if e and you be one.
I’d want to print out s present All right So since this condition is evaluated to true Paris the element is actually present in the stupid And that is why we print this out Now let me just check if the character s s present and this on diffidence present I want to print out as this present So this condition evaluates to false and nothing has printed out Now similarly let me go ahead and work with if enlist So if that list and then I’ll go ahead and create a list So l one and then I’ll give it a bunch of values inside this So then 22 d 40 and 50 Now I want a check of the first element.
This list is actually 10 And if the value is equal to 10 then I want to change it to 100 So if l went off and egg zero is actually equal do 10 Then I want to change this too 100 then I’ll finally print out this list right So initially though first element in this list will stand with the help of the F statement I’ve changed the Duke 100 now Similarly let me go ahead and work with F and Dictionary Dictionary Would I created a dictionary The one and then I’ll give it a bunch of key value parents over here.
I’ll type in the name of the fruit which is mango And then I’ll sign the value which is then and then the next food would be apple And then the cost would be Wendy And then the final fruit would be blown up and then the cost would be I heard you All right So now I were a check of the value off mango distant and effort is equal to 10 Then I’d want to add 100 more to this value so f d one off mango is actually equal Do then.
Then I’d want to add and more to this So d one off mango would be equal to the one off mango bless 100 and then I’ll print out dealing over here right So initially the cost of mango Winston then using the F statement I have incriminated the value Do 110 I guess.
This cell we can work with the F statement Now let’s head onto looping statements So looping statements are basically used to repeat a task multiple times So let’s understand looping statements with this example So you have a bucket and you want to completely fill it up with a mug off water So the conditioners while the bucket is not full you will keep on adding a mug off water to work until at best fool.
Here the repetition task us You will have a ma go for it and you will keep on pouring that into the bucket until a chestful repeating a task until the final condition is met And this is how the why loop works so and the new bank statements you basically have while and four So we’ll start with the Why loop So let’s go Raja Paternal book again.