How to process multi-line python input in HackerEarth window? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to process multi-line python input in HackerEarth window?

The below question is taken from HackerEarth it uses STDIN to read input How can take multi-line input like this one: 4 o m a r And output: omar *** it works for single line input but how to process for multi-line? char = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] makeList = [] a = input() for i in a: if i in char: makeList.append(i) hello = '' for j in makeList: hello = hello + j print('%s' % hello)

2nd Oct 2020, 6:25 AM
Adarsh Mamgain
Adarsh Mamgain - avatar
3 Answers
+ 4
according your description you have to implement 2 inputs: - for an integer number, that probably denotes the number of characters in the second input - for a string, containing letters and spaces. to be sure that your code covers all conditions, it is crucial to see the original description of the task. can you share the link to this challenge?
2nd Oct 2020, 9:29 AM
Lothar
Lothar - avatar
+ 4
Adarsh Mamgain , sorry, i tried to register at hackerearth.com, but it failed several times. Can you copy and paste the complete task description? Thanks!
3rd Oct 2020, 6:21 PM
Lothar
Lothar - avatar
0
https://assessment.hackerearth.com/challenges/test/practice-test-48823 Will you please help me with solution. Also I misunderstood the question Lothar
2nd Oct 2020, 9:55 AM
Adarsh Mamgain
Adarsh Mamgain - avatar