In: Computer Science
Using python Write a program that displays all of states in the U.S. and display each state that begins with the letter A.
Here Iam providing the code and the output for the given problem
Code
Output
Code
UsaStates =
["Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut","Delaware","Florida","Georgia","Hawaii","Idaho",
"Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine,Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana",
"Nebraska","Nevada","New Hampshire","New Jersey","New Mexico","New
York","North Carolina","North
Dakota","Ohio","Oklahoma","Oregon","Pennsylvania",
"Rhode Island","South Carolina","South
Dakota","Tennessee","Texas","Utah","Vermont","Virginia","Washington","West
Virginia","Wisconsin","Wyoming"
]
print("\n--- The All States in U.S are --- \n")
for States in UsaStates:
print(States)
print("\n--- States that begin with letter A ---\n")
for States in UsaStates:
if(States.startswith("A")):
print(States)