You are on page 1of 2

LIST or arrays:

SYNTAX: my_list=[variables,…. ]

Any type variable can be there.

ADDING 2 LIST:

My_list1=[1,2,3]

My_list2=[4,5,6]

ComboList=My_list1+My_list2

SORTING FUNCTION:

My_list1=[1,2,3]

My_list1.sort()

Slicing a List

My_list1=[1,2,3]

My_list[0:3]

TUPLES:
SYNTAX: My_tuple=(1,2,3,4…..)

List Inside a tuple

abc=tuple([1,2,3,4…..])

DICTIONARY:
SYNTAX: my_dict={key:value,key:value….}

To access my_dict{key}

Key or a value can be any data type string number etc.

Check keys in a dictionary


my_dict={"usairum":2499,"Osama":9922,"RESSCUE":1122}

my_dict.keys()

IF:
SYNTAX: if 2>1:

Print(“This condition is True”)

You might also like