Hello,
Say, I am taking an input from user via the statement: print “Type here”
Then what should I do to reverse the phrase? How can I assign the input
into
a variable and then issue the method .reverse?
Peace be upon you -
Junayeed Ahnaf N.
Twitter - @Nirjhor http://twitter.com/nirjhor
On 10/14/2011 09:03, Junayeed Ahnaf N. wrote:
Hello,
Say, I am taking an input from user via the statement: print “Type here”
Then what should I do to reverse the phrase? How can I assign the input into
a variable and then issue the method .reverse?
Take a look at the gets method:
http://rdoc.info/stdlib/core/1.8.7/Kernel:gets
-Jeremy
try mystring.reverse, i.e.
mystring=gets
newstring=mystring.reverse