reverse a string using an init method
+10 · 1 file changed
-
02.Reverse-A-String.py+10 −0
@@ -0,0 +1,10 @@ +__author__ = 'ovidiucs' + +class Reverse: + def __init__(self,string): + self.string=string[::-1] + +# at class instantiation +x = Reverse("LeGrand") + +print x.string \ No newline at end of file