Gallery
Debug 5.3. Baggage Check with starter code
Share
Explore

icon picker
Python Starter Code

Copy and paste the code below into your main.py file before you begin the task.
# print out a blank line
print('\n')

# ask the user to enter weight of first bag
baggage1 = int(input('Please enter the weight of first bag (kg): '))

# print out a blank line
print('\n')

# ask the user to enter weight of second bag
baggage2 = int(input('Please enter the weight of second bag (kg): '))

# work out the total
totalBaggage = baggage1 + baggage2;

# checks the user guess
# if it is the same as the computer number, display well done
# anything else display sorry message.

if totalBaggage < baggageLimit
print('That is OK ' + str(totalBaggage) + ' is under ' + str(baggageLimit) + ' Kgs. Thanks! ')
else
print('Sorry ' + str(totalBaggage) + ' is over ' + str(baggageLimit) + ' Kgs. You can pay extra though.')

# print out a blank line
print('\n')
Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.