+ 1
Can you help me with this code in the code coach, name "Ballpark orders", i inserted my code trial.
Python basics https://code.sololearn.com/c5KTGrSagAal/?ref=app
3 odpowiedzi
+ 9
Wesam Sobhy ,
to solve this exercise, we need to do these steps: (please read the task description carefully and follow it!. if you feel not familiar with the description below, you should continue learning first, then later try this code coach exercise again.)
> take 4 input values in one line, separated by a space.
> split the input at the spaces so that we get a list of items.
> iterate through the list of items, use the corresponding prices and sum them to a total.
> add the tax to the total and output the result.
+ 7
Wesam Sobhy
to implement the iteration and adding the prices we can do:
> after the input string has been splitted, all items (orders) are now individual strings in a list.
> to build the sum of all orders, we need an integer variable with name like *total*.
> now we need to iterate over this list by using a for loop like:
for order in <name of the list>:
if order == 'Pizza':
# add the respective price to total
elif ....
0
Iterate through the list of items, this is the step that I'm stuck in