Mar-26-2020, 07:01 PM
I'm new to programming btw.
I'm trying to write a program that will take a tuple of a list of toys, a tuple of the base prices for those toys, and calculate a 40% mark up and the final price (mark up + base) to get the retail price and then print the toys in one column, the base costs in one column, the mark up in one column, and the final price in one column. Here is what it should look like
![[Image: 5pH2QMo.png]](https://i.imgur.com/5pH2QMo.png)
Here is my program, which currently gets a string index out of range error and prints it incorrectly. Please help.
I'm trying to write a program that will take a tuple of a list of toys, a tuple of the base prices for those toys, and calculate a 40% mark up and the final price (mark up + base) to get the retail price and then print the toys in one column, the base costs in one column, the mark up in one column, and the final price in one column. Here is what it should look like
![[Image: 5pH2QMo.png]](https://i.imgur.com/5pH2QMo.png)
Here is my program, which currently gets a string index out of range error and prints it incorrectly. Please help.
#Variable List # toys - the tuple for the list of toys # costs - the tuple for the costs of each toy # mark - the 40 percent mark up # retail - the base cost plus mark up # count - the counter/sentry print ("Welcome to the Mark Up program") #step 1 - this will set up the toys tuple and the base cost of each toys = ("Teddy Bear","Toy Train","Hoola Hoop","Betsy Wetsy","Pogo stick") costs = (12.50,58.75,10.00,15.00,11.00) #step 2 - set up the for loop to calculate mark up on each toy print ("Item","\t\t","Cost","\t\t","Mark Up","\t\t","Retail") #step 3 - this will print and format the output for num in range(len(costs)): mark = num * .4 retail = mark + num costs = str(costs) mark = str(mark) retail = str(retail) print (toys[num],"\t",costs[num],"\t",mark[num],"\t",retail[num])