Python Programs on Classes and Objects, Classes and Functions, Classes and Methods

Veröffentlicht am: 02 Mai 2020
auf dem Kanal: TechKnowLogy Park
1,062
18

This video covers claases and objects, is as per VTU syllabus of B.E. 6th semester, Python Application Programming (17CS664).
In this video, Python programs are discussed on classes and objects, classes and functions and classes and methods.
Below programs are discussed in this video:
1) write a function called distance_between_points that takes two Points as arguments and returns the distance between them.
2) write a function named move_rectangle that takes a Rectangle and two numbers named dx and dy. It should change the location of the rectangle by adding dx to the x coordinate of corner and adding dy to the y coordinate of corner.
3)write a version of move_rectangle that creates and returns a new Rectangle instead of modifying the old one.
4) write a “pure” version of increment that creates and returns a new Time object rather than modifying the parameter.
5) write an init method for the Point class that takes x and y as optional parameters and assigns them to the corresponding attributes. Also write a str method for the Point class to print Point Object.
6) write an add method for the Point class that will add two Point objects.
7) write an add method for Points that works with either a Point object or a tuple:
If the second operand is a Point, the method should return a new Point whose x coordinate is the sum of the x coordinates of the operands, and likewise for the y coordinates.
If the second operand is a tuple, the method should add the first element of the tuple to the x coordinate and the second element to the y coordinate, and return a new Point with the result.

Below is the link to download list of overloaded operators in Python:
http://techknowlogypark.in/wp-content...

The book referred to make this video is 'Python for Everybody' and can be downloaded from the link given below:
http://greenteapress.com/thinkpython2...


Auf dieser Seite können Sie das Online-Video Python Programs on Classes and Objects, Classes and Functions, Classes and Methods mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer TechKnowLogy Park 02 Mai 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,062 Mal angesehen und es wurde von 18 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!