You are on page 1of 5

Camlin Page ol

Date 05 16 21
Hham lmp
psanit isalpha(O> Tue
3)poniti23'.isalpha ) false
pronitisdigit O false 4) 123isdjaitC)4 Tue
Lists
Users 1 C UseAs =list)_
Users pani, 'pashant'lo0, 'Rohan,81
Usensappemd Rupal')_
10LSens.imsert (3, Mainal ')
UES Pap () Remave last element
UseS. pap(2) Remaves element at idex 2
del_users[-] lat elemont)
Usersemn/e ('Rahan'
del use delete uers ist
USPTS index ("p10thant ")
U.Sers eMeNEe ) rverze the liBE
Sating Lit
usenssat()9Soatngpermanenty (in-pke)
20 L&es: Sct (reerse sIme eatingpermanerty moeere
Ider

Temporily an be_collected)
Sded userE) sohing UEA \in neu lit

Srted (Uses aevenseelne2

Eshang ng lanhda:
w& sart (key= Jambda A i uegsee Tue)
Users Sort (keylambda 2: (n[ai,L)
Camlin Page2
Date

Lumbens =Jist tange (1, 1000.aal)) Naking a litt_f


nubes om Ltoa
millim-
min (list)
max (list
Sum(list)
Aast hree = wexS.L-3:J
Useas Gpy sublist
stor End JumplGiap-

USespy s users ] ay nem nt shaloe

ist machensin

uppererr=user.upperl tor uaer in Users


Jclue UsEs=Luse muer () k ueeK in LUsE

ichionay setar di

fren {3 redido
eCke1 value
LInt, str, list, etc
Ke ist_
where-
25 ore 11pop) ap last element fam yeabte, key=i

re pap
key e4uineol
fseg papitem () Temnedast element nem dictl)
Camlin Page 3
Date
fre Lke1-append (Yalue)
E273, 4, 5,
value

fey Ckey1.inscat(2.33)
1 : , 2, 99, 3, 4, 5, 61
d e l hw key
name, amguag intau-Janquaaec.items():
pint (name "
tlansuage
name i n fav-Janguases kRys O:
ini name

ha Aanguagain_tav-languajes ialuerCL
prînt afku languageL

omcollectiosimpat OxdexedDict
DUlargungel= OxdexedDict
T itesdaak imposl peamutatims
peam= peamuladlns (Li2,3)

ur iin ist (pesm)


printi

tm ertaalsimprt Combinatign
Lamb= Cambnatins(To, ,2,3,4 4
fu i in ist (comb):
print(i)
e x ATays dgenemally when Pmblem
asks Smethme tlke: Cnsecutiveomtigunueknn
Subama

Use heap: generally whem tap-k, batrn-


max-L min-k etc Ome invalueel ins
Prds lem

20

Heap import heapqa h


e Ucesdt LL244, 3, 107
hhenpitusea)
(nnteap
topi= h heapppuwe)
top2 hq heappop (we)
h heappwh (e ers,(toplb-ip2
30
el2 Users= 2 2,6 3
UeysE Ue User_n U&eT|
C o m v e t i M /

n heapity (ues)
TOP h nJargest ( ,
allo
en
Camlij Page 655
Date

HashMap <Sting, BrayistSStig


J > map=_ney HachlMapl
List< List<Stinq2 euta neu AayListklist <Stinga=
Sin 1dr _ sts Jength
atrs CJ. taCharAnuy )
s t r i charAt (i)
char p_wOrd hoyo. Scat(wad)
Stmng valueCE
(aad

map.contaBnskey (key)-
value =map.get(ey)-
vale

AayList dd , reme(vaueel
dash Map_ put [key,Lizalue)_ emaeley

for MapEptnk Shing, Axaulist Stnng 2 emtaympemyet)=


tor
a s h s R

Tesult add (emty-geBlalue1);

CollectignsSctresult, neu Cmpaxutars Listz Stringazl1?


public int_ampare(List<sthingz_al Lislksiagg4)
SonT

eturn ol-get(0)-ompare Ta [02jetl


30

You might also like