Question: Edits for the code: I need help with the python programming code below and need an output to be like the example below. If number
Edits for the code: I need help with the python programming code below and need an output to be like the example below. If number of supermarkets keyed as 3, it will ask the next question in sequences of Supermarker 1, Supermarket 2, Supermarket 3.. for 3 times. Same goes to any other number of supermarket keyed. I have problem getting the same output with below code. Your help is much appreciated. # Python Code: no_of_market=int(input("Enter the number of supermarkets to visit")) for _ in range(no_of_market): no_of_aisle=int(input("Enter number of aisles in supermarket : ")) first_aisle=int(input("Enter first aisle: ")) second_aisle=int(input("Enter second aisle : ")) midpoint= (first_aisle+second_aisle)//2 print(f"The minimum distance is {(midpoint-first_aisle)*2 + (second_aisle-midpoint)*2} units")
Output should be: Enter number of supermarkets to visit : 3 Enter number of aisles in supermarket 1: 5 Enter first aisle: 1 Enter second aisle: 4 The minimum distance is 6 units Enter number of aisles in supermarket 2: 10 Enter first aisle: 4 Enter second aisle: 6 The minimum distance is 4 units Enter number of aisles in supermarket 3: 100 Enter first aisle: 1 Enter second aisle: 2 The minimum distance is 2 units
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
