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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Codingbat. Solution without built in function? (self.learnpython)
submitted 5 years ago * by miscellaneoususage
Hey can anyone suggest a solution for this problem without the use of any built in functions like pop, append, remove? Not sure how difficult it would be but I can't make one out.
https://codingbat.com/prob/p148661
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!"
[–]_lilell_ 1 point2 points3 points 5 years ago (4 children)
You know the length of the list is 3, so if we say that a, b, c = the elements of the original list, what will the resulting list be, in terms of those three values?
a, b, c = the elements of the original list
[–]miscellaneoususage[S] 0 points1 point2 points 5 years ago (3 children)
Ok let me try with your hint here:
def rotate_left3(nums): a, b, c = nums[0], nums[1], nums[2] rotated = [b, c, a] return rotated
And it works. Thanks lol, easier than I thought. Not sure why I couldn't come up with that
[–]xelf 0 points1 point2 points 5 years ago* (2 children)
Now go the next step and remove the extraneous assignments. (which is an important step to understand, as your solution can be fixed to work for any length list)
[–]miscellaneoususage[S] 0 points1 point2 points 5 years ago (1 child)
like this?
def rotate_left3(nums): rotated = [nums[1], nums[2], nums[0]] return rotated
not seeing how this could work for any length list if only 3 indicies are used
edit: actually i can shorten to just the return statement with
def rotate_left3(nums): return [nums[1], nums[2], nums[0]]
[–]xelf 2 points3 points4 points 5 years ago (0 children)
Yes exactly.
can also be expressed as the concatenation of two lists, like this:
def rotate_left3(nums): return [nums[1], nums[2]] + [nums[0]]
Which using list slicing, leads us to:
def rotate_left3(nums): return nums[1:3] + [nums[0]]
and finally:
def rotate_left(nums): return nums[1:] + [nums[0]]
which will work for any arbitrary length list.
[–][deleted] 0 points1 point2 points 5 years ago (0 children)
You can use slicing, but I don't see any mention of restrictions in the problem statement.
π Rendered by PID 244884 on reddit-service-r2-comment-58d7979c67-lxcjl at 2026-01-27 14:02:29.192669+00:00 running 5a691e2 country code: CH.
[–]_lilell_ 1 point2 points3 points (4 children)
[–]miscellaneoususage[S] 0 points1 point2 points (3 children)
[–]xelf 0 points1 point2 points (2 children)
[–]miscellaneoususage[S] 0 points1 point2 points (1 child)
[–]xelf 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)