Question: In this problem you should write a complete python program. Your program should accept a single string input from the user, which is supposed to
In this problem you should write a complete python program. Your program should accept a single string input from the user, which is supposed to be a location formatted as City, County, ST Where City is the name of a city, County is the name of the county that city is in, and ST is the two-letter US state acronym. The program you write needs to loop through this input string and do a bit of validation to see if it is formatted correctly. Your program should check whether or not the string has the following:
- Exactly 2 commas
- The two characters after the two commas must be empty spaces
- The last two letters are capitalized (you can use the s.isupper() function to check if a string s is capitalized)
If all of these conditions are met, the program should print Location formatted OK. If any are not met, it should print Location not formatted correctly. The only built-in strung function you are allowed to use are the upper and isupper functions. You may not use count, index, indexof, etc. You will want to use one or more if-statements, string indexing, and a while-loop.
Step by Step Solution
There are 3 Steps involved in it
Certainly Lets write a Python program stepbystep that meets the requirements youve stated Here are the steps that we will follow Step 1 Input Handling ... View full answer
Get step-by-step solutions from verified subject matter experts
