This FB Page Named ‘Frontlines Media’ Is Teaching Everything Through Memes & Is Highly Innovative & Useful

FB lo yenno pages choosa gani, ‘Frontlines Media’ lanti excellent page ni matram chudaledhu. Job & Education related content ni memes dwara easy ga janalaki ardam ayyela chestunnaru.Ee page ni every student and job search chese vallu follow aithe vallaki chala benefit untundi. And coming to the people who are doing this beautiful work through this page, you’re awesome brothers. Frontlines Media terrific content mee kosam

1) MATHS_THROUGH_MEMES

Frontlines Media Memes

1.1 

Frontlines Media Memes

1.2 

Frontlines Media Memes

1.3

Frontlines Media Memes

1.4 

Frontlines Media Memes2) SQL Through Memes

Frontlines Media Memes

2.1

Frontlines Media Memes

2.2 

Frontlines Media Memes

2.3 

Frontlines Media Memes

2.4 

Frontlines Media Memes3) Set / #Python

Frontlines Media MemesA set is a collection which is unordered and unindexed. We can exclude the duplicate items by using sets. So, it is faster than lists. In Python sets are written with curly brackets.{}

Example
Create a Set:

thisset = {“apple”, “banana”, “cherry”}
print(thisset)

Output is { ‘banana’ , ‘cherry’ , ‘ apple’ }

Note: Sets are unordered, so you cannot be sure in which order the items will appear.

Access Items
You cannot access items in a set by referring to an index, since sets are unordered the items has no index.

But you can loop through the set items using a for loop, or ask if a specified value is present in a set, by using the #in keyword.

Example
Loop through the set, and print the values:

thisset = {“apple”, “banana”, “cherry”}

for x in thisset:
print(x)

Output is
Cherry
Banana
Apple

Example
Check if “banana” is present in the set:

thisset = {“apple”, “banana”, “cherry”}

print(“banana” in thisset)
Output is true

Change Items
Once a set is created, you cannot change its items, but you can add new items.

Add Items
To add one item to a set use the add() method.

To add more than one item to a set use the update() method.

Example
Add an item to a set, using the add() method:

thisset = {“apple”, “banana”, “cherry”}

thisset.add(“orange”)

print(thisset)

Output is { ‘banana’ , ‘ cherry’ , ‘ orange’ , ‘ apple’}

Example
Add multiple items to a set, using the update() method:

thisset = {“apple”, “banana”, “cherry”}

thisset.update([“orange”, “mango”, “grapes”])

print(thisset)

Output is { ‘manago’ , ‘banana’, ‘grapes’, ‘cherry’ , ‘ orange’ , ‘ apple’ }

Get the Length of a Set
To determine how many items a set has, use the len() method.

Example
Get the number of items in a set:

thisset = {“apple”, “banana”, “cherry”}

print(len(thisset))
Output is 3

Remove Item
To remove an item in a set, use the remove(), or the discard() method.

Example
Remove “banana” by using the remove() method:

thisset = {“apple”, “banana”, “cherry”}

thisset.remove(“banana”)

print(thisset)

Output is { ‘ cherry’ ,’ apple’}

Note: If the item to remove does not exist, remove() will raise an error.

Example
Remove “banana” by using the discard() method:

thisset = {“apple”, “banana”, “cherry”}

thisset.discard(“banana”)
print(thisset)
Output is { ‘apple’ , ‘cherry’}

Note: If the item to remove does not exist, discard() will NOT raise an error.

You can also use the pop(), method to remove an item, but this method will remove the last item. Remember that sets are unordered, so you will not know what item that gets removed.

The return value of the pop() method is the removed item.

Example
Remove the last item by using the pop() method:

thisset = {“apple”, “banana”, “cherry”}

x = thisset.pop()

print(x)
Output is cherry

print(thisset)
Output is {‘ banana’ , ‘apple’}

Note: Sets are unordered, so when using the pop() method, you will not know which item that gets removed.

Example
The clear() method empties the set:

thisset = {“apple”, “banana”, “cherry”}

thisset.clear()
print(thisset)

Output is set() ( it represents an empty set)

Example
The del keyword will delete the set completely:

thisset = {“apple”, “banana”, “cherry”}

del thisset

Join Two Sets
There are several ways to join two or more sets in Python.

You can use the union() method that returns a new set containing all items from both sets, or the update() method that inserts all the items from one set into another:

Example
The union() method returns a new set with all items from both sets:

set1 = {“a”, “b” , “c”}
set2 = {1, 2, 3}

set3 = set1.union(set2)
print(set3)

Output is { 1, ‘c’ ,3 , ‘a’ , 2 ,’b’}

Example
The update() method inserts the items in set2 into set1:

set1 = {“a”, “b” , “c”}
set2 = {1, 2, 3}

set1.update(set2)
print(set1)

Output is { ‘c’ , 3 , ‘b’ , 1 , ‘a’ , 2}

Note: Both union() and update() will exclude any duplicate items.

There are other methods that joins two sets and keeps ONLY the duplicates, or NEVER the duplicates, check the full list of set methods in the bottom of this page.

The set() Constructor
It is also possible to use the set() constructor to make a set.

Example
Using the set() constructor to make a set:

thisset = set((“apple”, “banana”, “cherry”))
# note the double round-brackets
print(thisset)

Set Methods
Python has a set of built-in methods that you can use on sets.

add()
Adds an element to the set

clear()
Removes all the elements from the set

copy()
Returns a copy of the set

difference()
Returns a set containing the difference between two or more sets

difference_update()
Removes the items in this set that are also included in another, specified set

discard()
Remove the specified item

intersection()
Returns a set, that is the intersection of two other sets

intersection_update()
Removes the items in this set that are not present in other, specified set(s)

isdisjoint()
Returns whether two sets have a intersection or not

issubset()
Returns whether another set contains this set or not

issuperset()
Returns whether this set contains another set or not

pop()
Removes an element from the set

remove()
Removes the specified element

symmetric_difference()
Returns a set with the symmetric differences of two sets

symmetric_difference_update()
inserts the symmetric differences from this set and another

union()
Return a set containing the union of sets

update()
Update the set with the union of this set and others

4) Group Discussion Through Memes

Frontlines Media Memes

4.2

Frontlines Media Memes

4.3

Frontlines Media Memes

4.4

Frontlines Media Memes

4.5

Frontlines Media Memes

4.6

Frontlines Media Memes5) List / #Python

Frontlines Media MemesList is an ordered sequence of items..it is one of the most used data type in Python and is very flexible. All the items in a list do not need to be of same type (means we can assign string, float,int and other types in a one list).

Declaring a list is quite forward..items are separated by commas (,) are enclosed in square brackets [ ].

Example:- a= [ 1, 4.5, ‘ COC’ ]

We can use the slicing operator ( [ ])to extract the data from the list.

nums = [1, 4, 5, 6, 7]
nums
Output [ 1, 4, 5, 6, 7]
( We can assign same type of data also)

We can access the items by using array index in slicing operator…

nums[0]
Output is 1

Let us see different ways to access items from a list

nums[1:]
Output is [ 4,5,6,7]

We can access items by using negative index values…but here they start from backside of the array..

nums[-1]
Output is 7

( We can perform same actions as in strings… check our previous Post)

names= [ ‘coc’ , ‘ Frontlines’ ‘ Media’]
names

Output is [‘coc’, ‘ Frontlines ‘ , ‘Media]

We can add multiple lists in a single list ( list of lists)

COC = [ nums , names]
COC

Output is
[ [ 1,4,5,6,7] , [ ‘coc’, ‘ Frontlines ‘, ‘ Media’] ]

We can use default function in list by using dot (.) notation.

They are

Append, clear, copy , count , extend, index , pop, remove, push …..( We can find these functions when we we use dot notation behind the name of a list)

nums.append(0)
nums
Output is [1,4,5,6,7,0]

( The items will be added at the end of the array)

nums.insert(2:9)
nums

Output is [1,4,9,5,6,7,0]

( We can insert an item at the desirable index location…here 2 is the index and 9 is value)

nums.remove(5)
nums

Output is [1,4,9,6,7,0]

( We can remove an item by using remove function)

If you want to delete the items by using index number..we can use pop()

( we can come across about pop() in data structures…in stack we use pop() )

nums.pop(1)
Output is 4

nums
Output is [ 1,9,6,7,0]

We can use pop() without using index values..

nums.pop()
0
nums

Output is [1,9,6,7]

( It defaultly deletes last element..as like it follows last in first out rule in stack)

If you want delete multiple values

del nums[2:]
nums
Output is [1,9]

If you want to add multiple items..we have to use extend ()

nums.extend[ ( 2,3,4,)]
nums
Output is [1,9,2,3,4]

We can find minimum in the items by using min()

min(nums)
Output is 1

We can find maximum in the items by using max()
Output is 9

We can find sum of the items by using sum()
sum(nums)
Output is 19

We can sort the items in a list
sort(nums)

Output is [1,2,3,4,9]

List is mutable… means we can change the values in a list…

nums [2] = 10

nums

Output is [ 1,2,10,4,9]

Inka chala unnai lopala dacharu anthe, informative pages kosam chuse vallu ventane ee page ki vellipondi

 

Related Articles

Stay Connected

1,378,511FansLike
591,000FollowersFollow
1,320,000SubscribersSubscribe

Latest Posts

MOST POPULAR