Skip to content

Create list.py#13

Open
divesh2022 wants to merge 1 commit intosohailburki01:mainfrom
divesh2022:main
Open

Create list.py#13
divesh2022 wants to merge 1 commit intosohailburki01:mainfrom
divesh2022:main

Conversation

@divesh2022
Copy link

This program takes a single-line input string from the user and splits it into a list based on a user-specified separator. It includes exception handling to ensure that invalid inputs, such as an empty separator or an empty string, are handled gracefully.

What the Program Does:
Input Separator:

Prompts the user to enter a separator symbol (e.g., ,, -, etc.).
Validates that the separator is not empty.
Input String:

Prompts the user to enter a string that will be split using the separator.
Validates that the input string is not empty.
String Splitting:

Splits the input string into a list using the specified separator.
Error Handling:

Handles cases where the separator or string is empty by raising a ValueError.
Catches unexpected errors and displays an appropriate message.
Output:

Prints the resulting list after splitting the string.

@Harry-GNS
Copy link

You can add your project to my good first issue repository for Python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants