Что написать чтобы: количество товара умножалось бы на его цену (тоже есть в массиве goods, он вложенный, заметьте! ) и прибавлялось к суммарной стоимости total. #program little internet shop users = [ 'anna', 'bob', 'veronika', 'matthew', 'lucas', 'vladimir', 'michael', 'helena', ] goods = [ ['apples', 70], ['bananas', 30], ['sugar', 45], ['tea', 50], ['coffee', 95], ['ice cream',150], ] name = input('what is your name: ') print('hello, ' + name) something = input('what do you want to buy: ') count = input('how many: ') print('you want to buy ' + str(count) + ' ' + something) total = print('it will cost you ' + str(total) + ' rouble(s)')
users = [
'Anna',
'Bob',
'Veronika',
'Matthew',
'Lucas',
'Vladimir',
'Michael',
'Helena',
]
goods = [
['Apples', 70],
['Bananas', 30],
['Sugar', 45],
['Tea', 50],
['Coffee', 95],
['Ice cream',150],
]
name = input('what is your name: ')
print('Hello, ' + name)
something = input('What do you want to buy: ')
count = int(input('How many: '))
print('You want to buy ' + str(count) + ' ' + something)
for i in range(len(goods)):
if goods[i][0]==something: price=goods[i][1]
print(str(price))
total = price*count
print('It will cost you ' + str(total) + ' rouble(s)')