Home > database >  How to implement in Python, meowed, Python small white online for help
How to implement in Python, meowed, Python small white online for help

Time:11-15

With object-oriented knowledge. Write a program to program to include the following contents: a parent class, in its own name, such as Guangdong province, two in and around their own level city named subclass (through, for example, Foshan), the class inherits from the province class, use of prefectural class when instantiated as objects, object variables called her name (for example Qinshihuang),
Now you just received a $10000 venture capital funds, imagine himself has the following functions: (1) and the surrounding city, contact suppliers, suppliers are his places an instantiated object (e.g., Liubang), at the beginning of his hand. There are 100 goods, but there is not a dime each time you contact him, would have bought 1 item from his hand, and the payment of RMB 100, (2) when your inventory store up to 4 pieces, began to sell the goods, sell 1 piece at a time, each charge 10% of the profits, the buyer is the upstairs neighbor (he also places a instantiation objects, such as Hanxin), your buyers more picky and traded in every 4 times, with a 50% chance to refund 1 item, after the return of the goods at the price of 70 yuan each returned to the supplier (Liubang),
From your first product sales to achieve sales of 80 items for the first time in the process of the program is used to calculate the mathematical expectation of profit, and describe the changing trend, after each time the sales of expected profit output to the screen in the form of a dictionary, the keys of the dictionary for the number of sales, the value of the dictionary for the expected profit,