Python

Discussion on other languages at the COJ. This is the place to clear your doubts about these languages, and to share with the community the new things you learn about them.
User avatar
Phantom
Posts: 58
Joined: 6 years ago
Location: Cuba
Gender: None specified

Decorator

Post by Phantom » 6 years ago

No, you use the “@” only to say that you are using that function as a decorator. The problem in the decorator is that they receives another function, and return a new one, and that new function is the function that will replace the old one. You must understand only that, and you will understand decorators.



User avatar
Robbin
Posts: 38
Joined: 6 years ago
Location: Santiago de Cuba
Gender: None specified

Re: Python

Post by Robbin » 6 years ago

OK..
that´s better, now Ic can say I´m trying to understand the decorators :D
I think rigth now I´ll try to define some iterator, and get some practice..

aslf010990
Posts: 3
Joined: 6 years ago
Gender: None specified

Re: Python

Post by aslf010990 » 6 years ago

hello, Python advantages compared to java

User avatar
Phantom
Posts: 58
Joined: 6 years ago
Location: Cuba
Gender: None specified

Re: Python

Post by Phantom » 6 years ago

Is very easy answering that question, and at the same time, is very large. In few words I can say you that Python have a very simple syntax (more than Java, C, C++, C#, …) seem pseudo code. You do many things in less code. Is a language very simple and less dense than Java. This language is complex but not complicated. Python is a dynamic language and it saying many things. With Python you see the future in the present. The free software love Python (for example, Linux), most things in Linux is in this language. You have not compile your code to test it, in Python you can program in a TEXT, you save it like .py, and you can execute it!!

User avatar
Robbin
Posts: 38
Joined: 6 years ago
Location: Santiago de Cuba
Gender: None specified

Re: Python

Post by Robbin » 6 years ago

yes, python has a lot of unknown things(for me)..

and i like it becasuse you most make a "good structured program" to can work(you know, the identation thing..)

User avatar
Phantom
Posts: 58
Joined: 6 years ago
Location: Cuba
Gender: None specified

Re: Python

Post by Phantom » 6 years ago

Yes, thank you Robbin for help me to complement my arguments. That is one of the things I love of Python, your program in Python is naturally beautiful because the language force you to program beautiful. That make me remind the Zen of Python. One of the things the Zen of Python say is (beside is the first one): “Beautiful is better than ugly.” You want see The Zen of Python, by Tim Peters?? Type in Python: “import this”, and… cachan!! This is ones of the politics of the free software: Have good humor sense.

User avatar
Robbin
Posts: 38
Joined: 6 years ago
Location: Santiago de Cuba
Gender: None specified

Re: Python

Post by Robbin » 6 years ago

Yes I have seen zen already, but I don't understand some lines
in python the english is so hard..

User avatar
Phantom
Posts: 58
Joined: 6 years ago
Location: Cuba
Gender: None specified

Re: Python

Post by Phantom » 6 years ago

Jajajaja Python English is hard?? Jajaja good definition… Yes it happened to me too.

User avatar
Robbin
Posts: 38
Joined: 6 years ago
Location: Santiago de Cuba
Gender: None specified

Re: Python

Post by Robbin » 6 years ago

well i'll give you an advice:
don't try to make the 1767 in python..
first you most program it in c++..

ypozo
Posts: 5
Joined: 6 years ago
Gender: None specified

Python Round and Arrays

Post by ypozo » 4 years ago

Hi, congratulations!!, great posts !!!

Now, I´m looking for a nice "how to" round in python ??
and
I really need understand how work this:

Code: Select all

matrix = [[int(i) for i in raw_input().split()] for i in range(cant)] #in just a line of code
Course that this fill a matrix with ints, BUT wich numbers?: withs zeros or with 1, 2, 3 ... cant ???
I need know how to make the classic " int[] arr = new int[cant]; " in python (including that the major of langs fill with zeros 0 )

Best regards !!

Post Reply

Return to “Other languages”