Respuesta :
Answer:
Following are the program in the Python Programming Language.
#set and initialize list type variable
states=["Delhi", "UP", "MP", "Goa"]
#convert list into string and separated by(|)
result_string=" | ".join(states)
#print the value of the string
print(result_string)
Output:
Delhi | UP | MP | Goa
Explanation:
The description of the program that is in the Python Programming Language.
- Here, we set a list data type variable i.e.,"states" and initialize the list of states in it.
- Then, set a string data type variable i.e.,"result_string" and convert the list variable "states" into the string and separated by the vertical bar (|).
- Finally, print the value of the string variable "result_string".
The program written in python 3 seperates each city in list states by a vertical line. The program goes thus :
states = ["Delhi", "UP","MP","Goa"]
#populate a certain number of cities in the list named states
result_string = "|".join(states)
#inbetween each state, place a slash or vertical line between each consecutive state
print(result_string)
#display the slash seperate string which as been assigned to the variable result_string.
A sample run of the program is attached below.
Learn more :https://brainly.com/question/25160438
