I have a program that I need to make where I ask for the user's city and state, and ask them to type it in this format: city,state. The city must be printed on one line and the state just below. However, I am confused on how to accomplish this, because obviously the variable will be different among users and the index locations will change. Any help is appreciated.
This is what I have so far:
This is what I have so far:
def main(): # ask user for their city and staticmethod userInput = input("Please enter your city and state in the form of city,state") print("You live in the state of ",userInput[0, ","]) main()
Larz60+ write Nov-07-2020, 04:32 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Added for you this time, please use bbcode tags in all future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Added for you this time, please use bbcode tags in all future posts.