0

I have try to solve this question but i don't know what is wrong in my code. Only some case has passed. Tell my mistake not ans.

You work in a sign factory, and the machine has started printing all of the signs backwards! The signs have already been packed into boxes of four signs each. Every letter on every sign is capitalized, so if the original sign was of a palindrome (a word or phrase that is the same backwards and forwards) you can still save those signs and not have to reprint them. Check each box to see if you should open it up to dig out the sign you can save, or if you need to just throw the whole box in the trash. Task Given the four words that were supposed to be contained in each box, determine if at least one of them is of a palindrome. Input Format Four strings that represent the word or phrase that was supposed to be printed on the signs inside each box. Output Format A string that say 'Open' if at least one of the boxes is a palindrome or 'Trash' if all of the signs are misprinted. Sample Input CAT MONDAYS RACECAR TACOS Sample Output Open

14th Jul 2021, 2:08 PM
pawan rathor 2.0
pawan rathor 2.0 - avatar
13 odpowiedzi
+ 2
pawan rathor 2.0 Problem is in taking input. So As there are only 4 inputs then just do this count = 0 for i in range(4): word = input() if word == word[::-1]: count += 1
14th Jul 2021, 4:24 PM
A͢J
A͢J - avatar
+ 2
OMG!!! Nothing at all buddy. I am sure you will solve this problem. I count on you. Happy coding. Bye
14th Jul 2021, 3:31 PM
Shadoff
Shadoff - avatar
+ 2
I ᴀᴍ "Tɪᴍᴇ" thanks buddy 👍 Finally I have solved
15th Jul 2021, 3:26 AM
pawan rathor 2.0
pawan rathor 2.0 - avatar
+ 1
1.there must be 4 inputs!!! 2.No need to uppercase them.
14th Jul 2021, 3:01 PM
Shadoff
Shadoff - avatar
+ 1
I ᴀᴍ "Tɪᴍᴇ" can you tell me what is wrong here
14th Jul 2021, 3:14 PM
pawan rathor 2.0
pawan rathor 2.0 - avatar
+ 1
Change first 3 line of code to that: box = [input() for i in range(4)] count = 0 for i in box: ****** and change all word variable to box
14th Jul 2021, 3:16 PM
Shadoff
Shadoff - avatar
0
Shadoff ok but not expecting output
14th Jul 2021, 3:14 PM
pawan rathor 2.0
pawan rathor 2.0 - avatar
0
Shadoff not understand
14th Jul 2021, 3:21 PM
pawan rathor 2.0
pawan rathor 2.0 - avatar
0
Do you know English? what exactly from written above you didn't understand? Put my code instead of your first three lines of YOUR code. (change word variable in YOUR code to box)
14th Jul 2021, 3:28 PM
Shadoff
Shadoff - avatar
0
I know English but what do you mean In your code
14th Jul 2021, 3:29 PM
pawan rathor 2.0
pawan rathor 2.0 - avatar
0
Shadoff thanks buddy I will try
14th Jul 2021, 3:36 PM
pawan rathor 2.0
pawan rathor 2.0 - avatar
0
This one work perfect , the code it's weird: w1 = str(input()) w2 = str(input()) w3 = str(input()) w4 = str(input()) count= 0 if w1[0:]==w1[::-1]: count+=1 elif w2[0:]==w2[::-1]: count+=1 elif w3[0:]==w3[::-1]: count+=1 elif w4[0:]==w4[::-1]: count+=1 if count>0: print("Open") elif count==0: print("Trash")
30th Jan 2022, 2:09 PM
Moussa Diallo
Moussa Diallo - avatar
- 1
My code:count=0 word=input().upper().split() for i in word: if i[0:]==i[::-1]: count+=1 if count>0: print("Open") elif count==0: print("Trash")
14th Jul 2021, 2:10 PM
pawan rathor 2.0
pawan rathor 2.0 - avatar