#day2

Img

#day2 #fizzydrinkinspiredmakeupseries SPRITE INSPIRED MAKEUP LOOK

Read More
Img
Img

Hello everyone, To all the python programmers out there, I have brought few tricks for you to apply in your codes Trick 1: reversing a string my_string = "SONAKSHI" rev_string = my_string[::-1] print(rev_string) OUTPUT: IHSKANOS Trick 2: Find occurrence of all the elements in the list. from collections import Counter my_list = [1,2,3,1,4,1,5,5] print(Counter(my_list)) OUTPUT: Counter({1: 3, 5: 2, 2: 1, 3: 1, 4: 1}) Trick3: We all know elements of list are mutable(changeable), right? But do you know python has provided us with a way to make it immutable. using frozenset() my_list = [1,2,3,4,5] my_list = frozenset(my_list) my_list[3]=7 print(my_list) OUTPUT: Traceback (most recent call last): File "", line 3, in TypeError: 'frozenset' object does not support item assignment #day2 #python #programming

Read More