I was having trouble on how to write out my function, so that when more than one character is entered, it prints out the statement that the delimeter is too long. and returns the value none.But I don’t know how to do it. New to python and it would be a great help with some information. thanks in advance
this what I have done.
def my_split(_,_):
my_sep = input("seperator: ")
my_str = input("sentence: ")
def main():
#your main program here
print("Enter a string to be split: ")
print("Enter the delimiter character: ")
print("the result is: ")
for(my_sep):
if(my_sep <1):
print(" the delimeter is too long.")
return None
print("enter a string to be split: ")
print("enter the delimeter character: ")
print(" the result is: ")
main()
But it’s not clear where you want to put this in your code. What function are you trying to return
Nonefrom? I think you want something like this:Having filled in the
# do the actual splitting code here, here’s what happens when I run this twice: