Extra Terrestrial Stück! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Extra Terrestrial Stück!

word = "garbage" print(word[::-1]) word = "bathroom" print(word[::-1]) It shows as an error It's printing together instead of printing separately

14th Feb 2020, 10:36 AM
Manish Paul Simon
Manish Paul Simon - avatar
9 Answers
+ 2
Try this instead word=input() print(word[::-1])
28th Mar 2020, 3:00 PM
Abraham
Abraham - avatar
1st Jul 2020, 11:55 AM
Ikram Wadudu
Ikram Wadudu - avatar
+ 1
Your code, as you posted it in the question, reverses two words and prints them in two lines. If you get an error, you haven't showed us all we need to know!
14th Feb 2020, 11:27 AM
HonFu
HonFu - avatar
0
word = "garbage" print(word[::-1])ji word = "bathroom" print(word[::-1])
14th Feb 2020, 12:48 PM
Manish Paul Simon
Manish Paul Simon - avatar
0
I want to print them I separate lines
15th Feb 2020, 2:45 AM
Manish Paul Simon
Manish Paul Simon - avatar
0
The error showing up is that it prints in two lines together. But the solution wants to print one line for test 1. The another line for test 2.
15th Feb 2020, 2:46 AM
Manish Paul Simon
Manish Paul Simon - avatar
0
The output is showing two lines for both test 1 & test 2
15th Feb 2020, 2:46 AM
Manish Paul Simon
Manish Paul Simon - avatar
0
Here is my code: en = str(input()) alien = en.replace(en[0::1],en[-1::-1]) print(alien)
12th Jun 2021, 4:28 PM
Dao Huy Phuong
Dao Huy Phuong - avatar
0
Simplest ans : words = list(input()) words1 = words[::-1] print("" .join(words1) )
14th Oct 2021, 11:13 AM
Shekhar Patil
Shekhar Patil - avatar