I need to code a program that sort of turns text around a given character and deletes that character. The outcome will be sort of simple ASCII art. You need to input the character where the text will be turned around, and the amount of lines that the given input will be. An example would be: Input:
|
26
| oooo$$$$$$$$$$$$oooo
| oo$$$$$$$$$$$$$$$$$$$$$$$$o
$o o$ $$ o$ | oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$o $$ $$ $$o$ | o $ oo o$$$$$$$$$$$$$$$$$$$$
$$$o$$o$ |oo $ $ "$ o$$$$$$$$$ $$$$$$$$$$$$$ $$$$$$$$$o
$$$$$$$o $$$$$$$$ |"$$$$$$o$ o$$$$$$$$$ $$$$$$$$$$$ $$$
$$ | $$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$ """$$$ | $$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$
$$$$$$$$$ "$$$ | "$$$""""$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$$$$ "$$$o | $$$ o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$$o | o$$" $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" "$$$$$$ooooo$$$$o | $$$ $$$$$$$$$$$$$$$$
$$$oooo$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ o$$$$$$$$$$$$$$$$$| o
$$$$$$$$$$$$$$$$$$ $$$$"""""""" | $$$$$$$$"$$$$ $$$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$" o$$$ | """" $$$$ "$$
"$$$o """$$$$$$$$$$$$$$$$$$"$$" $$$ |
"$$""$$$$$$"""" o$$$ | $$$o
o$$$" | $$$$o oo
| "$$$$o o$$$$$$o"$$$$o o$$$$
| "$$$$$oo ""$$$$o$$$$$o o$$$$""
o$$$$$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$$$$$$"""
""$$$$$$$oo $$$$$$$$$$
""""$$$$$$$$$$$
$$$$$$$$$$$$
$$$$$$$$$$"
"$$$""""
I assume I would have to use substrings in order to do this, but I'm not sure how exactly I would have to do this. (sorry for bad explanation/english)
This is not too difficult. It helps to start with a plan of how you want to attack it.
delimiter
character and length
using
input
and create a variable to store the result.length
iterations.input
and split each line by the delimiter
You could have something like this:
delimiter = input()
length = int(input())
result = ""
for i in range(length):
line = input()
[end, start] = line.split(delimiter)
result += start + end + "\n"
print(result)