Help me in python | Sololearn: Learn to code for FREE!
+ 3

Help me in python

I need to enter a text string separated by spaces and each space must have a value in another string, for example. A = "One" B = "Two" C = "Three" D = "Four" Input Format: A B C D Output Format: One Two Three Four Input Format: A A Output Format: One One I am importing re module in python #I receive the text string text = input () if re.search (text, "A"):      print ("One") but it is very long and in the end I can't get the expected result. Please if you give me an idea or what module to use.

28th Apr 2020, 12:50 AM
Josshual A. Toro M.
Josshual A. Toro M. - avatar
5 Answers
+ 3
Josshual A. Toro M. here is a simple method based on your instructions. https://code.sololearn.com/crEneKsVYSBQ/?ref=app
28th Apr 2020, 1:14 AM
BroFar
BroFar - avatar
+ 13
28th Apr 2020, 3:37 AM
David Ashton
David Ashton - avatar
+ 5
It is quite simple bro just make a dictionary, take input then split it create a range of list then acces the value using dictionary print it and use end="" statement to print in same line . d = {' ':'', 'A':'one','B':'two','C':'three'} a=" A B C " b=a.split() for i in b: k=d[i] print(k,end=" ") See the above e example
28th Apr 2020, 12:59 AM
Ayush Kumar
Ayush Kumar - avatar
+ 1
Thanks all, i Clear my question.
28th Apr 2020, 1:57 PM
Josshual A. Toro M.
Josshual A. Toro M. - avatar
+ 1
there is a challenge here called no numerals and the approach is similar to what you need, here is my solution to see if it helps you https://code.sololearn.com/cc4lZ7WC7mOj/?ref=app
29th Apr 2020, 11:50 PM
Jonathan Alvarado
Jonathan Alvarado - avatar