Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use PYCHARM 2020: Problem: A road map defines locations as map references like B3, where B is the x-coordinate value and 3 is the y-coordinate.
Use PYCHARM 2020:
Problem: A road map defines locations as map references like B3, where B is the x-coordinate value and 3 is the y-coordinate. A B C D E F . Y Z 1 E2 2 3 B3 4 5 01 6 : 25 Y25 26 The grid lines are 0.5 km apart. Write a program that allows the user to enter a trip as a sequence of any number of map references on one line, and reports the total length of the trip, assuming they can travel in straight lines. For example: Enter trip map references: C2 B5 Y25 Total distance = 16.8 km For badly formatted map references, your program should exit, reporting the first bad map reference. Enter trip map references: E6 E4 D7 d43 F5 Bad reference: 043 Enter trip map references: D2 F23 Ja E23 Z2 Bad reference: Hints: You need to split the input line into separate references; each reference starts with one character which must be an upper case letter, and the rest must be only digits; and Pythagoras will help. The function exit() can abort the program if you detect an error in the input
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started