There is great debate over the best shape of a pizza. Write a program that allows the user to enter the diameter and cost of a pizza. It should then calculate the total size given first a square pizza and then a round pizza. It should then calculate the different between the two shapes as well as the cost per inch of the pizza and display the information to the user I need to create this program that shows which pizza is the best I would appreciate if pseudocodes and flowchart can be added so I can read it and understand it I created this code but it was just for the price and not the best pizza one "The point of the program is to figure out which is the better deal. Your program asks for separate costs.Your formula for the size of a round pizza is incorrect." this was the feedback I got # Enter the cost of square and round pizza cost_square_pizza = int(input("Enter the cost of square pizza: ")) cost_round_pizza = int(input("Enter the cost of round pizza: ")) # Enter the diameter of the pizza diameter = int(input("Enter the diameter of the pizza: ")) # size of the square pizza is calculated size_of_square_pizza = diameter*diameter # size of round pizza is calculated size_of_round_pizza = 3.14*(diameter*diameter)/4 # shape difference of square and round pizza is calculated shape_difference = abs((size_of_square_pizza-size_of_round_pizza)) # for printing the values upto 2 decimal places shape_difference = "{:.2f}".format(shape_difference) # cost per inch is calculted by dividing the size by cost cost_difference = abs((size_of_square_pizza/cost_square_pizza - size_of_round_pizza/cost_round_pizza)) # for printing the values upto 2 decimal places cost_difference = "{:.2f}".format(cost_difference) # printing the shape difference print("difference between two shapes : " , shape_difference ) # printing the cost difference print("difference between cost per inch of pizza :" , cost_difference)
There is great debate over the best shape of a pizza. Write a program that allows the user to enter the diameter and cost of a pizza. It should then calculate the total size given first a square pizza and then a round pizza. It should then calculate the different between the two shapes as well as the cost per inch of the pizza and display the information to the user
I need to create this program that shows which pizza is the best I would appreciate if pseudocodes and flowchart can be added so I can read it and understand it
I created this code but it was just for the price and not the best pizza one
"The point of the program is to figure out which is the better deal. Your program asks for separate costs.Your formula for the size of a round pizza is incorrect."
this was the feedback I got
# Enter the cost of square and round pizza
cost_square_pizza = int(input("Enter the cost of square pizza: "))
cost_round_pizza = int(input("Enter the cost of round pizza: "))
# Enter the diameter of the pizza
diameter = int(input("Enter the diameter of the pizza: "))
# size of the square pizza is calculated
size_of_square_pizza = diameter*diameter
# size of round pizza is calculated
size_of_round_pizza = 3.14*(diameter*diameter)/4
# shape difference of square and round pizza is calculated
shape_difference = abs((size_of_square_pizza-size_of_round_pizza))
# for printing the values upto 2 decimal places
shape_difference = "{:.2f}".format(shape_difference)
# cost per inch is calculted by dividing the size by cost
cost_difference = abs((size_of_square_pizza/cost_square_pizza - size_of_round_pizza/cost_round_pizza))
# for printing the values upto 2 decimal places
cost_difference = "{:.2f}".format(cost_difference)
# printing the shape difference
print("difference between two shapes : " , shape_difference )
# printing the cost difference
print("difference between cost per inch of pizza :" , cost_difference)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images