Write a function that make letters upper (in a sentence) but delete all things that are not letters like ( space punctuation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Write a function that make letters upper (in a sentence) but delete all things that are not letters like ( space punctuation

python help

22nd Oct 2018, 7:35 PM
safae safa
safae safa - avatar
11 Answers
+ 2
i am using a character table and in that range are all upper case letters thats why
22nd Oct 2018, 8:02 PM
Mbrustler
Mbrustler - avatar
22nd Oct 2018, 7:43 PM
Mbrustler
Mbrustler - avatar
+ 2
check is a list of all upper case letters like [A,B,C...] and the code checks if the sample elements match the check elements if not they will not be printed and ii == i ii = element in check i = element in sample
22nd Oct 2018, 7:55 PM
Mbrustler
Mbrustler - avatar
+ 1
but will the space deleted ? like HELLOWORLD not HELLO WORLD
22nd Oct 2018, 7:47 PM
safae safa
safae safa - avatar
+ 1
every thing that is not a upper case letter wont be addet to result play with the sample text
22nd Oct 2018, 7:48 PM
Mbrustler
Mbrustler - avatar
+ 1
but i didnot understand the use of "check ?? also what ii=i means ? thanks🍀
22nd Oct 2018, 7:51 PM
safae safa
safae safa - avatar
+ 1
and why exactly this range(65,91)
22nd Oct 2018, 8:00 PM
safae safa
safae safa - avatar
+ 1
oh ok . thanks alot
22nd Oct 2018, 8:03 PM
safae safa
safae safa - avatar
+ 1
no probs :)
22nd Oct 2018, 8:04 PM
Mbrustler
Mbrustler - avatar
0
I would probably do it like this: print(''.join(x.upper() for x in 'fde_g6 - dh.' if x.isalnum()))
22nd Oct 2018, 9:40 PM
HonFu
HonFu - avatar