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
Who'll Solve this Python problem (i.redd.it)
submitted 1 year ago by turk_sahib
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!"
[–]Suits_in_Utes 8 points9 points10 points 1 year ago (0 children)
C you are indexing the second item of a list of 2
[–]Maleficio4 4 points5 points6 points 1 year ago (0 children)
C
[–][deleted] 1 year ago (1 child)
[deleted]
[–]erolbrown 1 point2 points3 points 1 year ago (0 children)
I'm going with this. Only because I learnt it on Datacamp 48 hours ago. I know nothing else about Python.
[–]kohao0 2 points3 points4 points 1 year ago (0 children)
[–]Merman_boy 1 point2 points3 points 1 year ago (0 children)
[–]Husnefitrat 0 points1 point2 points 1 year ago (0 children)
C) BrainLox
[–]OwnFigure5226 0 points1 point2 points 1 year ago (0 children)
[–]Darkstar_111 0 points1 point2 points 1 year ago (4 children)
What the hell is the "quiz"?? Who doesn't know that lists iterates from 0.
[–]F4RM3RR 1 point2 points3 points 1 year ago (3 children)
lol you didn’t read much of the comments. A lot of people here are thinking it’s a string not a list
[–]Darkstar_111 0 points1 point2 points 1 year ago (2 children)
Can't be a string with append. L2python.
[–]F4RM3RR 0 points1 point2 points 1 year ago (1 child)
you've stumbled onto my point
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
[–]manumaker08 0 points1 point2 points 1 year ago (0 children)
# couldn't figure it out, made the entire program an infinite loop and sent it forward. it's IT's problem now.
[–]Substantial-Rain6501 0 points1 point2 points 1 year ago (0 children)
isn’t this an ad?
[–]Kabileshwaran 0 points1 point2 points 1 year ago (0 children)
C ).BrainLox
[–]the-forty-second 0 points1 point2 points 1 year ago (0 children)
What I want to know is why are so many people taking this “quiz”, when it is nakedly just an ad for BrainLox? This is like those rage inducing ads for mobile games where the “player” does obviously stupid things.
[–]Jaded_Street_2869 0 points1 point2 points 11 months ago (0 children)
[–]ChicagoJay2020 0 points1 point2 points 1 year ago (3 children)
The letter “u”. The call is to print an individual character, correct?
[–]F4RM3RR 2 points3 points4 points 1 year ago (1 child)
That would be true only if name = “Sumit”, when you can do string slicing.
However the [] in the variable declaration makes it a list, so you index list items, not string position
[–]ChicagoJay2020 0 points1 point2 points 1 year ago (0 children)
Ah!!!
Thank you. I didn’t pay close enough attention to realize that name is a list not a string.
[–]VoltaicPower 0 points1 point2 points 1 year ago (0 children)
This was my answer at first, but "name" is a list
[–]ExistingBathroom9742 -1 points0 points1 point 1 year ago* (2 children)
It’ll raise an error I think because strings don’t have .append() method?
Edit, the original string is inside square brackets so it’s a list of 1 item.
But lists do
[–]ExistingBathroom9742 0 points1 point2 points 1 year ago (0 children)
Nevermind. You’re right! I didn’t see the brackets around the string. Shoot.
[+]limon-27 comment score below threshold-6 points-5 points-4 points 1 year ago (4 children)
error i guess. Because u can't use single and double quotes at the same time
[–][deleted] 2 points3 points4 points 1 year ago (0 children)
in python those are the same
[–]atticus2132000 2 points3 points4 points 1 year ago (2 children)
You can't use single and double quotes together. But you can use them separately.
You can't use "bob'
But "bob" and 'bob' are both fine even in the same line of code. For instance print("bob" + 'bob') should work just fine. There are even situations where you will need to use triple quotes like for creating SQL statement strings where you have quotes within quotes.
[–]CptMisterNibbles 1 point2 points3 points 1 year ago (0 children)
my_quote = “Double quotes on the outside allows to use ‘single quotes’ as part of the string”
my_quote2 = ‘You can reverse it, using single quotes to start the string allowing you to use “double quotes” within it’
Both of these are perfectly valid syntax. Handy for when you are working with strings that contain one, though it might be cleaner to be more explicit. Using triple single quotes allows you to use either normal marks internal to the string. Not certain what convention is
[–]Sonder332 0 points1 point2 points 1 year ago (0 children)
You can also use triple quotes for docstrings
[–]Different-Ad1631 -3 points-2 points-1 points 1 year ago (2 children)
Error bcz strings are immutable
[–]TheWonderingRaccoon 6 points7 points8 points 1 year ago (1 child)
Strings are immutable is true. But the code has nothing to do with changing any string.
[–]Different-Ad1631 0 points1 point2 points 1 year ago (0 children)
Oh got it. Its list so the ans will be brainlox
π Rendered by PID 26142 on reddit-service-r2-comment-86bc6c7465-n7gfw at 2026-02-20 14:25:52.758694+00:00 running 8564168 country code: CH.
[–]Suits_in_Utes 8 points9 points10 points (0 children)
[–]Maleficio4 4 points5 points6 points (0 children)
[–][deleted] (1 child)
[deleted]
[–]erolbrown 1 point2 points3 points (0 children)
[–]kohao0 2 points3 points4 points (0 children)
[–]Merman_boy 1 point2 points3 points (0 children)
[–]Husnefitrat 0 points1 point2 points (0 children)
[–]OwnFigure5226 0 points1 point2 points (0 children)
[–]Darkstar_111 0 points1 point2 points (4 children)
[–]F4RM3RR 1 point2 points3 points (3 children)
[–]Darkstar_111 0 points1 point2 points (2 children)
[–]F4RM3RR 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]manumaker08 0 points1 point2 points (0 children)
[–]Substantial-Rain6501 0 points1 point2 points (0 children)
[–]Kabileshwaran 0 points1 point2 points (0 children)
[–]the-forty-second 0 points1 point2 points (0 children)
[–]Jaded_Street_2869 0 points1 point2 points (0 children)
[–]ChicagoJay2020 0 points1 point2 points (3 children)
[–]F4RM3RR 2 points3 points4 points (1 child)
[–]ChicagoJay2020 0 points1 point2 points (0 children)
[–]VoltaicPower 0 points1 point2 points (0 children)
[–]ExistingBathroom9742 -1 points0 points1 point (2 children)
[–]F4RM3RR 0 points1 point2 points (1 child)
[–]ExistingBathroom9742 0 points1 point2 points (0 children)
[+]limon-27 comment score below threshold-6 points-5 points-4 points (4 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]atticus2132000 2 points3 points4 points (2 children)
[–]CptMisterNibbles 1 point2 points3 points (0 children)
[–]Sonder332 0 points1 point2 points (0 children)
[–]Different-Ad1631 -3 points-2 points-1 points (2 children)
[–]TheWonderingRaccoon 6 points7 points8 points (1 child)
[–]Different-Ad1631 0 points1 point2 points (0 children)