Can you help me how to use capitalize in this code | SoloLearn: Learn to code for FREE!

0

Can you help me how to use capitalize in this code

words=input() print(*sorted(set(words().lower().split())) i want the first letter to be capital example: input:length sorting words length output:Length words sorting

1/16/2021 8:11:59 PM

a.m

12 Answers

New Answer

+4

In the name of kindly generous ALLAH Hello capitalize(): it method of string returns the first letter in capital form and the others in small form set(): two lows: 1:Do not have duplicates 2:Order that(of course has a bug sometimes,so you should sorted) (should not to use lower()) you can use for any element of splited string by space capitalize() and put it to an tuple or list such as st.capitalize() for st in input().split() try:(by loop) words=input() print(*sorted(set((t.capitalize() for t in words.split())))) Or you can use map(by map) words=input() print(*sorted(set(map(lambda st:st.capitalize(),words.split())))) and in compressed:(by compress) print(*sorted({st.capitalize() for st in input().split()})) ''' https://code.sololearn.com/cg6GLTvoTPZM/?ref=app https://code.sololearn.com/cxY2E66b12j3/?ref=app https://code.sololearn.com/cnyebrAv5bak/?ref=app

+2

HBhZ_C but set has forgotten it is for delete duplicates inputs

+1

Hello this is a try just use join to join elements in the list and create a string from the capitalized one.https://code.sololearn.com/cHRZJrF5tq4a/?ref=app

+1

a.m yes

+1

here in sololearn messaging

+1

what is your id on tel......?

0

Abol dadash irani hasti?

0

Dadash ye chand ta soal python hast yekhorde sakhte bizahmat mishe azat beporsam

0

a.m by ALLAH helps Go to pv for native speaking

0

Age mishe ye rah ertebati dg ok koni mamnon misham qz ALLAH ham behtarina barat mikham

0

Abol jan access behem dade nemishe

0

@A_m_ir_rr