Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions