python code for above question is attached below :-
# function to check for coupon code from the user
def check_promo(initial_amount,amount,s):
# taking user input yes or no
if s=='Y' or s=='y':
# if yes ask for coupon code
code = input('enter promo code of length 8: ')
# conditions for coupon code validation
if len(code)==8:
# calculating discount
discount = 0.1*initial_amount
return amount-discount
else: #if coupon code is invalid
# print invalid code and ask for coupon code again
print('invalid coupon code')
a = check_promo(initial_amount,amount,s)
return a
# if user enters no simply return the amount without discount
else:
return amount
# function to check the shipping details and amount
def check_shipping(amount,s):
# condition if user enters yes for shipping
if s=='Y' or s=='y':
return amount+7
else: #condition if user enters no for shipping
return amount
# function to check whether to gift wrap items
def check_gift_wrap(amount,s):
# condition for user entering yes for gift wrap
if s=='Y' or s=='y':
return amount+4
# else if users enters any other response return the amount without
extra charge
else:
return amount
# function to print the final bill
def print_result(initial_amount,amount,state_name):
# printing subtotal without extra charges
print('The Subtotal is ${0:.2f}'.format(initial_amount))
print('The state the user lives in is:',state_name)
# printing final total
print('The Total (subtotal plus any of the extra costs or
discounts) in USD ${0:.2f}'.format(amount))
# taking user inputs
number_pieces = int(input('enter the number of items required:
'))
initial_amount = number_pieces*12 #calculating the initial sub
total
amount = number_pieces*12
gift_wrap = input('you want it to be gift wrapped(Y for yes and N
for no): ') #asking for gift wrap
amount = check_gift_wrap(amount,gift_wrap) #amount after gift
wrap
shipping = input('you want it to be shipped(Y for yes and N for
no): ') #asking for shipping
amount = check_shipping(amount,shipping) #amount after shipping
charges
state_name = input('Enter yor state name(enter two letter
abbreviaiton of state name): ') #asking state name
promo = input('Do you have any promo code(Y for yes and N for no):
') #asking for any promo code
amount = check_promo(initial_amount,amount,promo) #amount after
applying any promo code
print_result(initial_amount,amount,state_name) #printing the final
bill
screenshot of the code for indentation reference : -



output : -
output 1 -

output 2 -
output 3 -

if my answer helped then please upvote and comment for any queries
thankyou !
his program sells only one thing. The Monkey King action figure. Users will be entering how...