Build a Bill Splitter - Step 6

Tell us what’s happening:

running_total += running_total+tip
print(‘Total with tip:’,running_total)

Above, I gave code with augmented operator correctly., But Still Step6 is asking some validation like ‘You should use the += operator to add the value of tip to your running_total.’

Your code so far

running_total = 0

num_of_friends = 4

appetizers = 37.89
main_courses = 57.34
desserts = 39.39
drinks = 64.21

running_total += appetizers + main_courses + desserts + drinks
print('Total bill so far:', running_total)

tip = running_total * 0.25
print('Tip amount:', tip)


# User Editable Region

running_total += running_total+tip
print('Total with tip:',running_total)

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

Challenge Information:

Build a Bill Splitter - Step 6

You are so close with this code! But think about how the += works. Remember that it’s already adding itself to whatever you put after the += so putting the same variable name there will actually add itself twice!

i.e.

a = 5
b = 1
a += a + b

a here will be 11 instead of 6 as you expect because a is being used twice.

If you need more help after that explanation, please let us know.