I'm new to python, so I'm trying to understand how to print a word diagonally (either right to left or vice versa).
So far, I've been trying to write it all under one function by defining the function.
Then using a for loop and inside including if statements as to whether right to left = True or False, but it's not working as I'm unaware of how to do it.
Answer
For top left to bottom right:
>>> word = 'HelloWorld'
>>> for i in range(len(word)):
... print ' '*i, word[i]
...HelloWorld
For top right to bottom left:
>>> word_length = len(word)
>>> for i in range(len(word)):
... print ' '*(word_length-i), word[i]
...HelloWorld
I have the following code: <a class="sectionname" href="#" onclick="expandAll();return false;">Expand all</a> When I click on expand all, the whole page loads…
This question already has answers here:How to store ner result in json/ database(2 answers)Closed 8 years ago.(S(PERSON Rami/NNP Eid/NNP)is/VBZstudying/VBGat/IN(ORGANIZATION Stony/NNP Brook/NNP Univers…
Im trying to see where a Python syntax error would be hiding. Both Django and pylint claim a syntax error at custom.py:41. Lines 41-42 read:(reading_threshold =int(request.POST[reading_threshold]))I do…
In order to work on my python skills, I am sometimes doing various challenges on the internet (eg on hackerrank). Googling for something else, I found this problem, and the accompanying solution on the…
I want to populate my json message with data from a CSV file. I want each row to be a "new" json object. I am using Python and will connect the the code to an API once done. Some of the data …
Closed. This question needs debugging details. It is not currently accepting answers.Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to repro…
This question already has answers here:How can I parse (read) and use JSON in Python?(5 answers)Closed 10 years ago.Please help me to parse this json in python.{ "IT" : [ { "firstName…
Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.Closed last month.Improve …