Soluții

Python Inheritance

Inheritance allows us to define a class that inherits all the methods and properties from another class.

  • Parent class is the class being inherited from, also called base class.
  • Child class is the class that inherits from another class, also called derived class.

Any class can be a parent class, so the syntax is the same as creating any other class:

  • Example

Create a class named Person, with firstname and lastname properties, and a printname method:

class Person:
def __init__(self, fname, lname):
self.firstname = fname
self.lastname = lname
def printname(self):
print(self.firstname, self.lastname)

#Use the Person class to create an object, and then execute the printname method:

x = Person(“John”“Doe”)
x.printname()

  • Create a Child Class

To create a class that inherits the functionality from another class, send the parent class as a parameter when creating the child class:

Create a class named Student, which will inherit the properties and methods from the Person class:

class Student(Person):
pass
[mai mult...]

Python Lambda

A lambda function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression.

Syntax
lambda arguments expression

The expression is executed and the result is returned:

Example

Add 10 to argument a, and return the result:

x = lambda a : a + 10
print(x(5
[mai mult...]

How to clear the Cache in WordPress ?

If you are new to WordPress, you will probably need to know how to clear your cache. If you are not familiar with the term, clearing your cache is simply a method of removing material and data from your website’s temporary storage. If you have made any modifications, you will know you are getting the most up-to-date material or data.

[mai mult...]

jQuery UI

jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you’re building highly interactive web applications, or you just need to add a date picker to a form control, jQuery UI is a perfect choice.

[mai mult...]