This is for my python class, so python code please. This code needs to take inputs from a outside source/program, not for specific examples. Sorry for the confusion. 9.12 LAB: Product class In main.py define the Product class that will manage product inventory. Product class has three attributes: a product code, the product's price, and the number count of product in inventory. Implement the following methods: A constructor with 3 parameters that sets all 3 attributes to the value in the 3 parameters set_code(self, code) - set the product code (i.e. SKU234) to parameter code get_code(self) - return the product code set_price(self, price) - set the price to parameter price get_price(self) - return the price set_count(self, count) - set the number of items in inventory to parameter count get_count(self) - return the count add_inventory(self, amt) - increase inventory by parameter amt sell_inventory(self, amt) - decrease inventory by parameter amt
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
This is for my python class, so python code please.
This code needs to take inputs from a outside source/program, not for specific examples.
Sorry for the confusion.
9.12 LAB: Product class
In main.py define the Product class that will manage product inventory. Product class has three attributes: a product code, the product's price, and the number count of product in inventory.
Implement the following methods:
- A constructor with 3 parameters that sets all 3 attributes to the value in the 3 parameters
- set_code(self, code) - set the product code (i.e. SKU234) to parameter code
- get_code(self) - return the product code
- set_price(self, price) - set the price to parameter price
- get_price(self) - return the price
- set_count(self, count) - set the number of items in inventory to parameter count
- get_count(self) - return the count
- add_inventory(self, amt) - increase inventory by parameter amt
- sell_inventory(self, amt) - decrease inventory by parameter amt
Step by step
Solved in 4 steps with 3 images