Here your example…: def printHelloWorld() --puts "Hello World!!" end printHelloWorld() I put the “Hello World” in a function, because you want the declaration of a function. In Ruby are a “print” too, but “print” is like a “printf(“Hello World”);” in C++ (without the ‘\n’ at the end). You see?? Is a...
---This “self” mean that the method, is an instance method. This “self” is like the “this” in C#, C++, Java, etc. to refer to the actual instance. ---Now, In Python you can do “static methods” too. If you want that, you write: @staticmethod def pepe(val…): … #in this case you have not put the “self”...
Jajajaja In my opinion, Ruby is a strong language for the same reason that Python is a strong language. If you understand why Python is a strong language, you understand why Ruby is a strong language. In my opinion Python and Ruby is almost the same, with the difference that one recognize for indent...
Jajajaja My brother was the first person in talk to me about Python and it’s strong. Since I began to learn Python, I decided be a Python prophet :D I had something hidden for you. You wanted a tree, and I implemented for you a Binary Search Tree with everything: Insert, Remove, Search and the diffe...
hey: I got another question: how can I read an entire string on a cicle? :?: if I put: for i in range(range): a=raw_input() it doesn't work help me of course!! How you expect that work?? range is a function that return a list of values beginning in 0 and ending in the predecessor of the number you ...
First: you wrote well "etcetera", in english is in this manner (without tilde). Second: Yes, as you said. You can also add attributes to a class after it created. For example: class Friend:pass pepe = Friend() pepe.Name = "Pepe" pepe.Salute = lambda: "Hello, people!!" Now pepe have the "property" -N...
Yes, I have some goods books and tutorials. If you want, give me your email, and I'll send you some documentation. The classes in Python is very simple, but... previously I want you know somethings. In Python are specials methods that give to the class an especific property. For example, if you want...
:lol: Sorry if I didn´t explained very well. ----I´ll answer first the second question(How do I use the words "sequence" and "condition"?) 1.1)When I say "sequence" I refer to that :) , to any collection, for example: sequence = 1,2,3,4,5,6 equivalent to: sequence = (1,2,3,4,5,6) sequence = [1,2,3,4...
You have to see the matrix in Python as an array of array. You know how read an array. For this reason, you can do this: cant = input() #imagine they tell you first the number of rows matrix = [[int(i) for i in raw_input().split()] for i in range(cant)] #in just a line of code :D As well, you can wr...