Question
P1 See the HW08P1.py file provided. Each comment line specifies a requirement. In the line after each comment, write a Python statement to meet that
P1 See the HW08P1.py file provided. Each comment line specifies a requirement. In the line after each comment, write a Python statement to meet that requirement.
class Stock(object): def __init__(self,name="A",qty=10): self.__name = name self.qty = qty def get_item_name(self): return self.__name def show_double(self): x = self.qty * 2 print(x) def show_increase_by(self, y): x = self.qty + y print(x) item1 = Stock() #Create an object - item2 - with name of B and qty of 5
#Display the name of item1
#Display the qty of item1
#Set the qty of item1 to 24 (without recreating the entire object)
#Using the method provided, show what would be twice the qty of item1
#Using the method provided, show what would be the qty of item1 with 10 added
#Assign the qty of item1 minus 5 to a variable named temp_qty
#Display the value in temp_qty
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started