Python Beginners Tutorial | Collections LIST | Basic Programming 5

preview_player
Показать описание
There are 4 Collection data types in Python

List | Tuple | Set | Dictionary

List [] ordered | indexed | changeable | duplicates
Tuple () ordered | indexed | unchangeable | duplicates
Set {} unordered | unindexed | no duplicates
Dictionary {K:V} unordered | changeable | indexed | no duplicates

CODE - List

my_list = ["Tokyo", "London", "New York"]
print(my_list)
print(my_list[2])

my_list[2] = "New Delhi"
print(my_list)

for val in my_list:
print(val)

print(len(my_list))

print(my_list)
print(my_list)

print(my_list)
print(my_list)

del my_list[1]
print(my_list)

print(my_list)

fruits = ["apples", "oranges", "cherry"]
print(fruits)
print(fruits)

my_list_2 = ["apples", 1,2,3.0]
my_list_3 = ["apples", [1,2,3], ['a','b','c']]
print(my_list_3[1][1])

#PythonBasics #Collection #List

ONLINE COURSES TO LEARN

------------ UI TESTING ------------

------------ API TESTING ------------

------------ MOBILE TESTING ------------

------------ CI | CD | DEVOPS ------------

------------ VERSION CONTROL SYSTEM ------------

------------ PERFORMANCE TESTING ------------

------------ JAVA ------------

------------ MAVEN ------------

------------ OTHERS ------------

------------ Follow ------------

________ ONLINE COURSES TO LEARN ________

Рекомендации по теме
Комментарии
Автор

Loved the simplicity in teaching and also appreciate your effort to teach different methods associated with each one of the collections.

I am eagerly waiting for upcoming courses of Python with Selenium as there is much course on this topic

cgthejesh
Автор

Very straightforward and simple. Thanks a lot mate, it's a excellent course.

BurnedZero
Автор

Thank you so much Sir for taking out time and making videos. It's very clear and understandable.

MoniKumari-jemz
Автор

Hi Raghav, thanks for the videos.
I have a doubt with 'Remove' function. If there are duplicate values in the List, which value is removed first ?
If in case it removes which ever is first in the list(from below example 3 at index 1) then how to remove 3 at index 4 and index 7 without using remove function multiple times? Please help! Thank you in advance.
Ex: list=[1, 3, 4, 5, 3, 6, 7, 3]
list.remove(3)

poornimab
Автор

Sir, can you please say about inbuilt functions of list, please give some examples of list slicing. How to perform list slicing ?

uttamabanerjee
Автор

Bro, plz make a complete video for java selenium testing using testNg, maven, log4j, jenkings...single complete testing script.

faisalsakib
Автор

Sir, explanation is so good, simple and clear. Easy to understand concept. I have a doubt in list. How to get the maximum and minimum number from a-list .

uttamabanerjee
Автор

Hi Raghav, I always follow your video when I need. I was looking for some automation in jira defect extract for multiple project but I could not find any related video here. Thought to ask you the queries if you can help
Currently in jql query I am passing as ( project in (x, y, z) and issue type = bug) and it give me the bug id for x, y, z project only. I want to read the project from Excel so that in future if any new project added I can just update the sheet not the script. Am trying for loop but am unable to use issetype=bug in the query. It is saying bug is not define. Can you guide me how I can achive it. Or if you have any link which I can refer pls suggest.

Thanks

neelambikalearnfun
Автор

class Myclass:
f_name = "Mitul"
l_name = 'Singh'

def __init__(self, fname, lname, age):
self.f_name = fname
self.l_name = lname
self.age = age


def sum(self, a, b):
print(a+b)


x = Myclass("Shivanshi", 'Sharma', 6)
print(x.f_name)
x.f_name = 'Lipika'
print(x.f_name)
#del x
del x.f_name
print(x.f_name)
x.sum(7, 7)

Print(x.f_name) after del.x.fname is printing "Mitul" no error is coming.


Shivanshi
Lipika
Mitul
14

Process finished with exit code 0

pallavisharma