Придумать код Python для решения следующей проблемыPython

Программы на Python
Anonymous
Придумать код Python для решения следующей проблемы

Сообщение Anonymous »

Предположим, обложка книги составляет 24,95 доллара США, но книжные магазины получают скидку 40 %. Стоимость доставки составляет 3 доллара США за первую копию и 75 центов за каждую последующую копию. Какова общая оптовая стоимость 60 экземпляров?

Вот что я пробовал:

a='coverprice'
>>> b='discount'
>>> c='shipping costs'
>>> d='additional copies'
>>> e='no. of copies'
>>> a=24.95
>>> b=0.4
>>> c=3
>>> d=0.75*59
>>> e=60
>>> print ('total costs=',c+d)
total costs= 47.25
>>> f='total cost'
>>> print ('total discount=',b*a)
total discount= 9.98
>>> g='total discount'
>>> print('total purchase cost before discount=',a*e)
total purchase cost before discount= 1497.0
>>> h='total purchase cost before discount'
>>> print('total purchase cost after discount=',h-g)
Traceback (most recent call last):
File "", line 1, in
TypeError: unsupported operand type(s) for -: 'str' and 'str'
>


Подробнее здесь: https://stackoverflow.com/questions/620 ... ng-problem

Вернуться в «Python»