Hello to everyone. How can I get the output {} if an empty string is entered | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hello to everyone. How can I get the output {} if an empty string is entered

Description in code. Please help.My brain is already burning.I did part of the task, but this part cannot be mastered in any way https://code.sololearn.com/c1M89nO9p3kO/?ref=app

13th Jul 2020, 6:51 AM
Михаил
7 Answers
+ 3
remove comma first and split.. words = input().replace(',',"").split()
13th Jul 2020, 7:31 AM
Jayakrishna 🇮🇳
+ 4
Михаил Don't think like that. It happens when you learn.
13th Jul 2020, 7:56 AM
A͢J
A͢J - avatar
+ 3
Михаил You can also do like this if you forgot to use replace. words = input() if words != '': words = words.split(', ')
13th Jul 2020, 7:46 AM
A͢J
A͢J - avatar
+ 2
Михаил in programming, you have to experience all things like this to get better programmer. (No need ashamed, Ofcouse in any matter, unless if it is intential mistake).. You're welcome...
13th Jul 2020, 7:48 AM
Jayakrishna 🇮🇳
+ 2
Jayakrishna🇮🇳 ,AJ Anant Thanks for the kind words
13th Jul 2020, 7:59 AM
Михаил
0
Jayakrishna🇮🇳 thanks. How could I forget about replace. I am ashamed
13th Jul 2020, 7:40 AM
Михаил
0
AJ Anant I feel dumb myself
13th Jul 2020, 7:49 AM
Михаил