Problem 58573. Am I a city or a state
Input will be an array of cities and states. Also, lists of cities and states will be passed.
Replace every city name with "city" and every state with a "state" string.
Input:
A = ["Natick", "Wayland", "Framingham", "Chicago"];
B = ["MA", "IL"];
arr = ["Wayland", "Chicago", "IL"];
Ouput:
arr = ["city", "city", "state"];
Solution Stats
Problem Comments
-
1 Comment
Richard Zapor
on 17 Jul 2023
The problem set is incorrect. To make string variables requires usage of " " (double quotes) not ' ' single quotes. B=[ "MA" "IL"]
Solution Comments
Show commentsProblem Recent Solvers9
Suggested Problems
-
Back to basics 11 - Max Integer
807 Solvers
-
07 - Common functions and indexing 5
426 Solvers
-
Sum the real and imaginary parts of a complex number
143 Solvers
-
Find out sum of all elements of given Matrix
531 Solvers
-
435 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!