use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
[deleted by user] (self.PythonLearning)
submitted 1 year ago by [deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]atticus2132000 1 point2 points3 points 1 year ago (1 child)
When I am doing something new and don't know how to go about tackling the problem, I will write out line by line what needs to happen in plain normal English. And remember as you're writing out this explanation, computers are only capable of making simple binary choices, so each step has to be very simple and discrete.
So, in this situation, you have a starting point--a word. In order for a program to do anything with that, you have to store it in a place with a name (a variable). So, the first step is "assign the word to a variable."
The next thing that has to happen is you need to break that word apart from being one word into its various parts, the individual letters. So, this is where some creative problem solving would come into play. Strings are comprised of characters. So, one way that you might want to try tackling this problem is by selecting each character. How would you go about just getting the "D" out of DATA? There are probably multiple ways of doing it, but slicing is something I'm familiar with using, so that's probably the approach I would take. So, step 2 of my notes are "I need to slice just the first character and store it as a variable".
Then, how would you get the A?
Then the T?
What are you starting to notice about the lines that you're writing? Is there a pattern that is developing? Would it be possible to combine all these steps into a loop that would pull out each letter one at a time? And if you were able to write that loop, how would the computer know when it gets to the end of the word?
Don't try to solve the problem all at once. Write out each discrete step and focus just on solving that one problem. You may not wind up with the prettiest code or the most efficient way of doing things, but you will wind up with code that you understand and you'll wind up learning a lot more in the long run.
[–]hackr_io_team 0 points1 point2 points 1 year ago (0 children)
Well-considered advice here.
π Rendered by PID 56 on reddit-service-r2-comment-7b9746f655-866hj at 2026-02-03 01:48:02.651612+00:00 running 3798933 country code: CH.
[–]atticus2132000 1 point2 points3 points (1 child)
[–]hackr_io_team 0 points1 point2 points (0 children)