示例#1
0
from shirt import Shirt

new_shirt = Shirt('red', 's', 'short sleeve', 45)
orange_shirt = Shirt('orange', 'L', 'short sleeve', 15)

print(new_shirt.__doc__)

# print

print(new_shirt.color)
print(new_shirt.size)
print(new_shirt.style)
print(new_shirt.price)

new_price = new_shirt.change_price(10)
print(new_shirt.price)

new_discount = new_shirt.discount(0.3)
print(new_discount)
示例#2
0
#
#
###
shirt_one = Shirt('red', 'S', 'long-sleeve', 25)

### TODO:
#     - print the price of the shirt using the price attribute
#     - change the price of the shirt to be 10
#     - print the price of the shirt using the price attribute
#     - print the price of the shirt with a 12% discount
#
###
print(shirt_one.price)
shirt_one.change_price(10)
print(shirt_one.price)
print(shirt_one.discount(.12))

### TODO:
#
#    - instantiate another object with the following characteristics:
# .       - color orange, size large, style short sleeve, and price 10
#    - store the object in a variable called shirt_two
#
###
shirt_two = Shirt('orange', 'L', 'short-sleeve', 10)

### TODO:
#
#    - calculate the total cost of shirt_one and shirt_two
#    - store the results in a variable called total
#
from shirt import Shirt

new_shirt = Shirt('Red', 'M', 'short sleeve', 50)

print(new_shirt.color)
print(new_shirt.size)
print(new_shirt.style)

# change price method
new_shirt.change_price(32)
print(new_shirt.price)

# discount method
print(new_shirt.discount(0.2))

tshirt_collection = []

shirt_one = Shirt('red', 'S', 'short-sleeve', 15)
short_two = Shirt('blue', 'M', 'long-sleeve', 35)
short_three = Shirt('yellow', 'L', 'short-sleeve', 20)

tshirt_collection.append(shirt_one)
tshirt_collection.append(short_two)
tshirt_collection.append(short_three)

for i in range(len(tshirt_collection)):
    print(tshirt_collection[i].color)
from shirt import Shirt
from shirt import Jean

shirt_one = Shirt('orange', 'S', 'long sleeve', 45)
shirt_two = Shirt('red', 'XL', 'short sleeve', 30)

print(shirt_one.color)
print(shirt_two.price)

shirt_two.change_price(23)
print(shirt_two.price)

print(shirt_one.discount(.1))

shirt_one.color = 'purple'
shirt_one.size = 'L'
shirt_one.price = 38

jean_one = Jean('red', 'L', 70)
print(jean_one.color)
print(jean_one.size)
print(jean_one.price)
示例#5
0
from shirt import Shirt

if __name__ == '__main__':
    shirt_1 = Shirt('red', 'M', 'long_sleeved', 55)
    shirt_2 = Shirt('orange', 'S', 'short_sleeved', 30)

    print(shirt_1.get_price())
    print(shirt_2.get_price())

    print(shirt_1.discount(0.81))

    shirt_1.change_price(60)
    print(shirt_1.discount(0.81))
示例#6
0
#
#
###
shirt_one = Shirt('red', 'S', 'long sleeve', 25)

### TODO:
#     - print the price of the shirt using the price attribute
#     - change the price of the shirt to be 10
#     - print the price of the shirt using the price attribute
#     - print the price of the shirt with a 12% discount
#
###
print(shirt_one.price)
shirt_one.change_price(10)
print(shirt_one.price)
print(shirt_one.discount(.12))

### TODO:
#
#    - instantiate another object with the following characteristics:
# .       - color orange, size large, style short sleeve, and price 10
#    - store the object in a variable called shirt_two
#
###
shirt_two = Shirt('orange', 'L', 'short sleeve', 10)

### TODO:
#
#    - calculate the total cost of shirt_one and shirt_two
#
###