Hi, I need help with this question. MUST BE IN PYTHON. This is in the section fo
ID: 3730548 • Letter: H
Question
Hi, I need help with this question. MUST BE IN PYTHON. This is in the section for defining functions so it must have a define function and a define main. Program listed as Sales.py
Explanation / Answer
def totalcost(n):
t_s_c = 8.99;
s_t = 0.085;
totalcost = n*t_s_c*(1+s_t);
return totalcost;
def salescost(n):
t_s_c = 8.99;
s_t = 0.085;
if(n<=3 and n>0):
return totalcost(n);
elif(n%4==0):
return salescost(n-1);
else:
return salescost(n-1)+totalcost(1);
def main():
print("# of T-shirts Original Cost Sales Cost")
for i in range(1,11,1):
print(" %d $%.2f $%.2f" %(i, totalcost(i) , salescost(i)))
main()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.