Skip to main content


Welcome to Daily Updates

*** Happy Learning***

==>Bigg Boss 6 Telugu

==> JAVASCRIPT QUIZ

==>AADHAAR download, Date of birth,name and Address correction, PVC card and more links

==> MICROSOFT EXCEL TUTORIAL

Python Tutorial_List_Tuple_Dictionaries


                           List

*  List is a collection of data, 

* List will have a name like variable and stores multiple data with comma separate. 

* it is ordered manner.

* It has index, starts from 0. 

* Lists are mutable, means can change the list post define 

Ex: Even_numbers=[2,4,8,10]

Even_numbers[2]=6

print(Even_numbers[2])

Output: 6

* List can store different data types in single list

Ex: Number= [90,"Ram",0.90]

Index of 90 is 0 

Index of Ram is 1

Index of 0.90 is 2

* String is a collection of characters, however string is immutable 

name = "Mobile"

print(name[0]) --output= M

* Slicing in list 

F_names=["Banana","Mango","Grapes","Apple"]

F_names[1:3] 

Output: ["Mango","Grapes"]

Note: for slicing in List python F_name[1:3] - only 1, 2 index data will out

Note: On strings also can perform slicing in python 

* Slicing can do in three different ways on List and Strings in Python

First way - To get the elements from very first element in List 

Flowers=["Lilly","Rose","Sunflower"]

print(Flowers[:2])

Output: ["Lilly","Rose"]

Note: Flowers[:2], this will result start from very first element of List untill first index element

Second way - To get the elements untill last element index in List

Flowers=["Lilly","Rose","Sunflower"]

print(Flowers[1:])

Output: ["Rose","Sunflower"]

Note: Flowers[1:], this will result untill last element of the list from index number 1

Third way- To get all the elements of List

Flowers=["Lilly","Rose","Sunflower"]

print(Flowers[:])

Output:["Lilly","Rose","Sunflower"]

Note: Flowers[:], this will result all the elements of the list

* Negative Indexing in List - to get from Last elements in strings and List

Ex: Vowel_letters=["a","e","i","o","u"]

print(Vowel_letters[-1]

Output: u

Fruit= "Apple"

print(Fruit[-1])

Output- e

Slicing with both negative and positive indexes 

Ex: Vowel_letters=["a","e","i","o","u"]

print(Vowel_letters[2:-1])

Output: ["i","o"]

* Check whether element available in List

Vowel_letters=["a","e","i","o","u"]

print( 'a' in Vowel_letters)

Output: True 


Fruit= "Apple"

print('A' in Fruit)

Output- True


                Tuple 

* Used for ordered collection

* Tuples can have data with different data types 

* Defined data in Parentheses ().

* The difference between list and tuple is tuple is immutable and also append function won't work for tuple

That is we can't change the value once the tuple created

Example:

Tu_flower=(1,2,6)

Tu_flower[1]=5 //Error

* To count number of times integer repeated in a tuple, for finding this we can use count function

For instance,

Marks=(7,9,7,8,6,5,4,3,4)

print(Marks.count(7)) //2

* variables can be assigned the data available in a tuple


Example: R=("SS",8)

Name,ID=R

print (Name) //SS

print (ID) //8


In the scenario where the tuple length is not know then we can go with the asterisk symbol along with variable so that all the data will be copied to the variable but it will be converted to list format

Example: R=("SS",8,7,6,9)

Name,*IDs=R

print (Name) //SS

print (IDs) // [8,7,6,9]


Here IDs is List format 

 


       Dictionaries

* Dictionaries are one of the python collection 

* Each dictionary has key: value pair 

Example:

 Student= {

"Name":"DailyUpdates234",

"Course studying": "Python"

}

Here Name, Course studying are keys and DailyUpdates234 and Python are the values

* Keys should be unique else overwritten with new value


For instance,

Student= {

"Name":"DailyUpdates234",

"Course studying": "Python",

"Name":"DailyUpdates"

}

print(student["Name"])

** When trying to extract Name key's value then DailyUpdates will be the output

* Function used for doing operations on the dictionaries are 

-> update()

For instance,


Student= {

"Name":"DailyUpdates234",

"Course studying": "Python"


}

student.update({"Name":"DailyUpdates"})

-> items()

To get all the key value pairs of a dictionary

For example,

Student.items()

-> pop()

To delete an data use this

Student.pop("Name")





Comments

Popular posts from this blog

JNTUK R16 percentage calculation

JNTUK R16 PERCENTAGE CALCULATION Here R16 batch students can calculate percentage according to obtained CGPA throughout the graduation. JNTUK introduced SGPA, CGPA in 2020 batch that is R16 REGULATION. Most of the companies ask percentage but students suffer how much percentage equal to obtained CGPA. for that here providing a wonderful platform for calculation of percentage by providing CGPA. ENETR CGPA BELOW BOX AND GET PERCENTAGE: ENTER CGPA    Percentage   For Lateral Entry students CGPA Calculator-  click here for Regular students CGPA Calculator -   click here Andhra Pradesh SI and Constable recruitment Notification 2022 Details - Click here for more details feel free to comment

JNTUK R16 SGPA and CGPA calculator for Lateral entry b.tech

Lateral entry students those are joined directly engineering by completing polytechnic, they may or may not appeared for ECET for getting seat in engineering course. that is B.Tech students studied course in 4 years but lateral entry students studied course is 3 years, that one year spend in polytechnic course. Lateral entry students strong in Technically than regular students. for SGPA calculator -   click here NOTE: IF ANYONE WANT CALCULATE UPTO SOME SEMISTERS(LIKE UPTO 3-2) FOR PLACEMENTS CAN PROVIDE REMAINING SGPAS AND TOTAL CREDITS AS ZEROS(0) THEN WILL GET ACCURATE CGPA TILL THAT PARTICULAR SEMISTER. FOR LATERAL ENTRY SCHEME B.TECH CGPA IS... FIRST SEMISTER SGPA    total credits   SECOND SEMISTER SGPA    total credits   THIRD SEMISTER SGPA    total credits   FOURTH SEMISTER SGPA    total credits   FIFTH SEMISTER SGPA    total credits   SIXTH SEMISTER SGPA    to

JNTUK R16 SGPA and CGPA Calculation

JNTUK university is affliating many colleges of eastern part of the Andhra Pradesh. JNTUK introduced SGPA AND CGPA concept by declaring result with grade secured and grade points, also credits. total credits for R16 is 180. Grade points for grades. SGPA has to calculate every semister but CGPA is caluculated over all semisters Grade - Grade points 1. O - 10 2. S - 9 3. A - 8 4. B - 7 5. C - 6 6. D - 5 7. F - FAIL For SGPA calculation for every semister - click here NOTE: IF ANYONE WANT CALCULATE UPTO SOME SEMISTERS(LIKE UPTO 3-2) FOR PLACEMENTS CAN PROVIDE REMAINING SGPAS AND TOTAL CREDITS AS ZEROS(0) THEN WILL GET ACCURATE CGPA TILL THAT PARTICULAR SEMISTER. FOR CGPA ENTER DETAILS BELOW : FIRST SEMISTER SGPA    total credits   SECOND SEMISTER SGPA    total credits   THIRD SEMISTER SGPA    total credits   FOURTH SEMISTER SGPA    total credits   FIFTH SEMISTER SGPA    total credits