I was using my old C++ assignments to teach myself Python and ran into issues every other line of code. In my attempt to find another way to ease into the lang I found what I think is an awesome tool "How to Think Like a (Python) Programmer" I understand most of what is being talked about and the exercises are simple, so I can learn the languge in smaller bites. Which, brings be to my issue.
Write a function right_justify that takes a string named s as a parameter and that prints the string with enough leading space so that the last letter is in column 70 of the diplay
def right_just(s): while len(s)!=70: # while statement to add white space to sting until lenght ==70 " "+s print s # print string with last letter in column 70 of the display
Most of the problems I have had so far are caused by thinking in C++ and not Python. I would not doubt that this is the problem here, but I can not find a good example to help me see my error. Thanx in advance I really appreciate all time people take to answer my questions.
I am also aware of rjust(), ljust(), and center() I am just trying to complete the exercise.