Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 4.1 PEP 257 – Docstring Conventions @info:cursos:pue:python-pcpp1:m2
- de that you want to test, e.g.: <code python>def fun(val): return val * 2 user_value = int(input("Enter the value: ")) # fun(user_value) # user_value = user_value + "foo" print(fun(user_value))</code> * they can help you plan yo... pe //str// helps us minimize the risk of certain (un)expected situations – it reduces the risk of pass
- 3.1 PEP 8 – Introduction @info:cursos:pue:python-pcpp1:m2
- le conventions. These tools can be installed and run locally, or accessed online. We want to show you ... n> pip install pycodestyle </code> * You can run it on a file or files to obtain information about... tion”. Examples: <code python ❌> # Bad: def my_fun_one(x, y): return x * y def my_fun_two(a, b): return a + b </code> <code python ✔> def my_fun
- 4.1 Shallow and deep copy operations @info:cursos:pue:python-pcpp1:m1
- . Don’t treat it as an absolute memory address. Run the code presented in the right pane to see how t... n values of the id() function must be the same. Run the code presented in the right pane to confirm o... both variables referring to the same identity?” Run the code presented in the editor. <code python> ... e object?", a_list is b_list) </code> When you run the code, you get the following output: <code ; o
- 2.7 Encapsulation @info:cursos:pue:python-pcpp1:m1
- s if they were attributes. Examine the code and run it to see if it follows your expectations. <code... : raise AccountError("No es pot modificar un número de compte!") @account.deleter... raise AccountError("No es pot esborrar un compte amb saldo diferent de 0") else: ... raise AccountError("No es pot esborrar un compte amb saldo diferent de 0") else:
- 1.6 Making life easier with the requests module @info:cursos:pue:python-pcpp1:m4
- ms – //an open-source, cross-platform JavaScript run-time environment that executes JavaScript code ou... to https://nodejs.org/en/download, download and run the Windows installer (a file with a name that lo... s.org/en/download, download the ''pkg'' file and run the installer. Whole process looks the same as on... console and... * ...if you're a Windows user, run the **CMD.EXE** program (as an ordinary user) and
- 2.2 Inheritance and polymorphism — Inheritance as a pillar of OOP @info:cursos:pue:python-pcpp1:m1
- ss class MFD_SFP(Scanner,Printer,Fax): pass oUn=MFD_SFP() oDos=MFD_SPF() oUn.scan() oUn.print() oUn.send() oDos.scan() oDos.print() oDos.send() </code> == Inheritance and polymorphism — I
- 2.1 PEP 20 – The Zen of Python @info:cursos:pue:python-pcpp1:m2
- o to the editor window, type in ''import this'', run the code, and voilà! Can you see what happens? W... program will not crash. On the contrary, it will run without any problems and output a fine result. Al... t’s analyze the following example: <code python> fun(1, 2, 3) fun(a=1, b=2, c=3) </code> The two function invocations may be the same, but not necessaril
- 2.3 A small lexicon of widgets - Part 3 @info:cursos:pue:python-pcpp1:m3
- d, as the widget doesn’t take the focus itself. Run the code and test its behavior. <code python> im... command=about_app) window.mainloop() </code> Run the code and test it. Do you see that strange das... Check line #21 – this will tell you everything. Run the code. The strange dashed line appearing at t... indow.mainloop() </code> Analyze line #19, and run the code to see the difference. Of course, you c
- 4.2 Serialization of Python objects using the pickle module @info:cursos:pue:python-pcpp1:m1
- ning a string, an integer, and a list. When you run the code presented in the right pane, a new file should be created. Remember to run the code locally. <code python> import pickle a_... ully, and now we can retrieve it from the file. Run the code in the editor and see what happens. <co... ta.size) print(data.get_size()) </code> If you run the code, you receive: <code ; output> Traceback
- 5.1 Metaprogramming @info:cursos:pue:python-pcpp1:m1
- ny object, make use of the ''type()'' function. Run the code in the right pane to see the ''type()'' ... instance in the computer memory; this method is run before ''%%__init__%%''(); * ''%%__init__%%''... s! == Metaprogramming – another metaclass Let's run a more serious experiment: try to build a metacla... th classes rely on the same metaclass. When you run the code, you'll see that both class instances ar
- 1.2 Let TkInter speak! @info:cursos:pue:python-pcpp1:m3
- mpanion there is nothing more you can do. Let's run the code now. Did you get the same window as our... . Be aware of this! Now we're fully prepared to run the code. <code python> import tkinter skylight... be passed to the ''Button'' object. Now we can run the code and check if our button is functional. W... can see, the mechanism is easy and handy. Let's run the code and check its results. We hope that you
- 1.7 Four magic letters: CRUD @info:cursos:pue:python-pcpp1:m4
- tents. Reading raw JSON messages isn't a lot of fun. To be honest, it's not fun at all. Let's make things a bit more fun, and write some uncomplicated code to present server respons... st. Keep your fingers crossed as we’re going to run it now. This is the output:<code ; output> {"id"
- 1.1 Classes, Instances, Attributes, Methods — introduction @info:cursos:pue:python-pcpp1:m1
- a place which binds data with the code. If you run the code, there are no visible effects. The class... ttribute, issue: print(duckling.height). If you run the code, you'll get the following example: <code... class is contained in %%**__class__**%%. If you run the code presented in the right pane, you'll get
- 2.4 Decorators @info:cursos:pue:python-pcpp1:m1
- the code presented in the right pane. When you run the code, the result should be: <code ; output> W... transcribed to the code presented on the right. Run it to see the output and compare it to the output... hon> @object_counter class Car: </code> When you run the code, you can see that access to the 'mileage
- 2.1 Python core syntax @info:cursos:pue:python-pcpp1:m1
- method, __add__(), which will fix the problem. Run the code to check our prediction. <code python>c... the __abs__ and __add__ special methods. Try to run your own experiments with built-in methods. Now