I'm calculating the price

Asked 2 years ago, Updated 2 years ago, 23 views

This is the code that I wrote

You're supposed to make a guy that works like this

If you select y to continue ordering, the price should be added to the customer in the same seat I keep getting new seats and saving them If you choose n, you get a new customer Which function should I use to print out the price of the matching table number in the list-dictionary?

If you select order payment number 3 and enter the table number, the price of the table should be eliminated, but what function should I use here?

The explanation is difficult, but I'd appreciate it if you could answer it even if you knew it.

python

2022-09-22 18:11

1 Answers

dic['price'] = a

It's being used like this.

dic['price'] +=a

If you use it like this, you'll keep adding value to the price.

However, since the dic dictionary does not have an initial value,

if 'price' in dic:
    dic['Price'] = 0
else:
    dic['price'] += a

You can use it like this.


2022-09-22 18:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.