Practical tasks Decorators, OOP, Python Core, Data Software Engineering, Epam Training

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's move on WE and now let's talk about uh let's talk about the decorators class uh class method abstract method property static method class based decorators class related decorators okay practical task one we are given the description you need to create upstar class vle and cles car motorcycle truck bus that are inherited from vehicle class vehicle accepts the following parameters brand name should be string year of issue should be integer base price integer millage integer uh here you can see the example values Honda 2020 1,10,000 okay and there the following method should be implemented vle type return to string the type of the vehicle in the following pattern brand name plus name of the class for example Toyota car Suzuki motorcycle uh like brand name and then name itself okay and each motorcycle return bulling value depends on the amount of Wheels it could be two wheels if this is a motorcycle or car and four wheels for car and then put your price Returns the price of the vehicle base price minus 0.1 multiply M if the result price is less than uh 100,000 message should return 100,000 yeah put the following decorators where the necessary like abstract method class method static method property and others and here is example We call we create a vle uh type of topple and we have four Vehicles car motorcycle truck and bus for each we pass it the arguments brand name year base price Mage and then we iterate our vehicles for each for each vehicle in vehicles print vehicle type vehicle type is this is a motorcycle or not and put yours price and here we can see the results like if this is a first Toyota car first Toyota are checking is motorcycle false this is not motorcycle and P Price is 985 and here you can see base price and pous price what is the PCH price it's actually base price minus 0.1 multip by millage and in this case if this value in like surpasses the 100,000 we should return 100,000 always okay let's how we can do this how we can Implement first all let's call the abstract class and Abstract method to inherit our to create our vehicle we class inherited from abstar class and we will initialize brand name as a string year of issue is a integer base price also is an integer and Mage integer here and then we should create new function or new method Wheels number this is just upstar Clause we should we can um we can just write pass because it will be implemented in our car like in our classes like car motorcycle and here uh you should create a new function vehicle type and return the brand name and class name like here brand name plus name of the class how we can get the name of the class just simple class and name and for checking his motorcycle we should check the wheels number like if the wheels number is equals to two it should return two it's a motorcycle otherwise false it's not a motorcycle and also put price method that will return the flood this is a price base price minus 0.1 multip by Mill and we are checking here maximum it should be 100,000 if price is more than 100,000 it will return the 100,000 and here we uh return the maximum price like price of the pchas and 100,000 you should check we should get maximum value because it say here if the result price is less than 100,000 message should return 100,000 only always so it will return the 100,000 in case price is less okay now let's create the classes car motorcycle truck and bus inherited from and here we call the wheels number and here on property we return the four because car has a four wheels for motorcycle two for truck 10 and four b six and this property will check here our abstract method will number and this property Will's number is from here our abstract method let's see the results TK return [Music] F Let's test it out Simply copy this we are given now un command vle for and D now we can call our function or call our M uh module let's here and we got the results vehicle type Toyota car is motorcycle fs and put your price 95 985 .0 and Etc all of them
Info
Channel: Tech With Abee
Views: 42
Rating: undefined out of 5
Keywords: Python, C++, C#, API, Dart, Flutter, Swift, JavaScript, Java, Django, Flask, FastAPI, TypeScript, Redux, Solidity, game development, software development, web development, tutorials, stream, tech, code, CodeWithTim, TechWithAbee, SQL, GraphQL, Telegram bot, online, project, LeetCode, startups.
Id: z681B6rmw_g
Channel Id: undefined
Length: 8min 37sec (517 seconds)
Published: Tue Jun 18 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.