- I am trying to print string and its corresponding decimal ascii value directly below it. This seems like a simple task but after copious research I have not yet found a solution to my issues. Using the end=" "argument to theprintfunction did not work, and neither did anything else I found on stackoverflow. In its current state it prints vertically, down the command prompt, which is not what I want. I need it to print horizontally.
string = "hello world"
for ch in string:
  print(f'''
        {ch}
        {ord(ch)}
        ''')
- Desired Output:
h   e   l   l   o        w   o   r   l   d
104 101 108 108 111  32  119 111 114 108 100 
Actual Output:
h
104
e
101
... ... trimmed for brevity ... ...
l
108
d
100
- I know that somewhere along the way I would have to worry about the width of the top line being smaller than the width of the bottom line so that characters match up nicely, but assume I am not worrying about this for now.
 
    