I am new to python, have a book and playing around so please be kind. Mainly I have been playing with ASCII art
What I am trying to do is hide some art into some text. So say I have a string print out "word", what I want to do is write a function that helps me insert a character into the middle of that word regardless of how long the word is, it always places my art character into the middle of the word. So my output would be 'wo-rd'. What I have started with so far is:
def dashinsert(str):
return str[:2] + '-' + str[2:]
I know that this is no where close on where it needs to be, and I am only a beginner, but any direction to look is appreciated, I am not sure I am doing some of this right either
My goal is to learn from this and then insert random characters into words at various positions to make art in text. ie I type a paragraph and the art will insert itself as a function. Right now I am just trying to get this insert portion down
Use double slashes for integer divide
def dashinsert(str):
midPoint = len(str)//2
return str[:midPoint] + '-' + str[midPoint:]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With