Can someone please help me to solve this question using Phyton? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Can someone please help me to solve this question using Phyton?

https://www.sololearn.com/coach/51?ref=app

27th May 2020, 8:22 AM
Hadif Syahputra
35 Answers
+ 10
x = input() print(x[::-1]) This is the shortest method to solve the question But you have aready solved this question, right?
27th May 2020, 8:30 AM
Namit Jain
Namit Jain - avatar
+ 15
Check my codes they all are in python
27th May 2020, 5:48 PM
Bharat
Bharat - avatar
27th May 2020, 5:52 PM
Bharat
Bharat - avatar
+ 4
Ok then copy your code and paste here
27th May 2020, 8:29 AM
Kiran Deep Naidu
Kiran Deep Naidu - avatar
+ 4
Can you explain why?
27th May 2020, 8:31 AM
Hadif Syahputra
+ 4
Ok Thanks a lot I really appreciate your help Thanks guys
27th May 2020, 8:34 AM
Hadif Syahputra
+ 4
Ok👌 Thank you Thank you Thank you
27th May 2020, 8:36 AM
Hadif Syahputra
+ 4
You can see the explaination + solution here https://code.sololearn.com/W5Dyu7fP15N8/?ref=app BTW you misspelled Python
28th May 2020, 6:01 PM
Mehnaz ✨
Mehnaz ✨ - avatar
+ 3
A string can also be said as a list of letters... To get some part of a list:- List[start(default=0) : end(default=len(List)) : step(default=1)] So with this we are decreasing our steps by putting -1.... For understanding we can also type: print(x[0:len(x):-1])
27th May 2020, 8:34 AM
Namit Jain
Namit Jain - avatar
+ 3
Try this code(this code is available for a sentence too andi not only words) sentence_in_english = input() sentence_inverse = [] for word in sentence_in_english.split(): word_inverse = word[::-1] sentence_inverse += word_inverse print("".join(sentence_inverse))
27th May 2020, 11:35 AM
Taha Lyousfi
+ 3
string = input() #we use input() for asking input from the user and assigning to an argument called string. print(string[::-1]) #we can slice the string using [ ] called slicing operator. If you have learned about list and their indices then you will be clear that negative index is used for reversing. The same list method can be established for string also.
28th May 2020, 3:13 PM
Jenson Y
+ 3
Phyton?
28th May 2020, 9:50 PM
SapphireBlue
SapphireBlue - avatar
29th May 2020, 7:29 AM
Vaibhav Chaudhary
Vaibhav Chaudhary - avatar
+ 3
(•‿•)
29th May 2020, 7:34 AM
Hadif Syahputra
+ 2
Please show up your attempt first and then if any errors found we will help you out...
27th May 2020, 8:23 AM
Kiran Deep Naidu
Kiran Deep Naidu - avatar
+ 2
Please post in over here or send a link of your code
27th May 2020, 8:28 AM
Kiran Deep Naidu
Kiran Deep Naidu - avatar
+ 2
Hadif Syahputra The problem is that you didn't take the input at run time
27th May 2020, 8:33 AM
Kiran Deep Naidu
Kiran Deep Naidu - avatar
+ 2
Ok
28th May 2020, 2:29 AM
Hadif Syahputra
+ 2
It is so easy to reverse a word but if we need to reverse all words in a sentence, the code would be like this: def rev(string): b=list(string) b.reverse() sep='' l=sep.join(b) return l ourlang=input('Enter the sentence to be converted:') k=list(ourlang.split(' ')) for i in k: c= rev(i) print(c,end=' ')
29th May 2020, 8:22 AM
Danda Harshavardhan reddy
Danda Harshavardhan reddy - avatar
+ 1
Ok
27th May 2020, 8:23 AM
Hadif Syahputra