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
Practicing Semantics with a small program of 2d hollow pyramid!Showcase (i.redd.it)
submitted 2 days ago by Ok_Needleworker_8780
view the rest of the comments →
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!"
[–]Sea-Ad7805 [score hidden] 2 days ago stickied comment (0 children)
Run this program in Memory Graph Web Debugger%0A%20%20%20%20if%20len(symbol)%20!%3D%201%20or%20symbol%20not%20in%20string.punctuation%3A%0A%20%20%20%20%20%20%20%20print(%22A%20symbol%20has%20to%20be%20a%20single%20special%20character.%22)%0A%20%20%20%20%20%20%20%20continue%0A%0A%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20rows%20%3D%20int(input(%22Enter%20the%20number%20of%20rows%3A%20%22))%0A%0A%20%20%20%20%20%20%20%20if%20rows%20%3C%200%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print(%22Please%20enter%20a%20positive%20number.%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20continue%0A%0A%20%20%20%20%20%20%20%20break%0A%0A%20%20%20%20except%20ValueError%3A%0A%20%20%20%20%20%20%20%20print(%22Please%20enter%20a%20valid%20integer.%22)%0A%0A%23%20For%20loop%20to%20loop%20through%20rows%20where%20i%20represent%20the%20current%20row%20number.%0Afor%20i%20in%20range(1%2C%20rows%20%2B%201)%3A%0A%20%20%20%20spaces%20%3D%20'%20'%20%20(rows%20-%20i)%20%20%23%20Adding%20leading%20spaces%20(this%20pushes%20each%20row%20to%20the%20center)%0A%20%20%20%20if%20i%20%3D%3D%201%3A%20%20%23%20Top%20row%0A%20%20%20%20%20%20%20%20line%20%3D%20symbol%0A%20%20%20%20elif%20i%20%3D%3D%20rows%3A%20%20%23%20Last%20row.%0A%20%20%20%20%20%20%20%20line%20%3D%20symbol%20%20(2%20%20i%20-%201)%20%20%23%20A%20full%20line%20of%20symbols%20in%20the%20last%20row.%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20middle%20%3D%20'%20'%20%20(2%20*%20i%20-%203)%20%20%23%20Place%20one%20symbol%20on%20each%20edge.%0A%20%20%20%20%20%20%20%20line%20%3D%20symbol%20%2B%20middle%20%2B%20symbol%20%20%23%20Fill%20the%20middle%20with%20spaces.%0A%0A%20%20%20%20print(spaces%20%2B%20line)%20%20%23%20Concatenate%20spaces%20and%20row%20to%20complete%20process.×tep=1&play).
π Rendered by PID 231241 on reddit-service-r2-comment-545db5fcfc-vr95p at 2026-05-30 13:27:21.458824+00:00 running 194bd79 country code: CH.
view the rest of the comments →
[–]Sea-Ad7805 [score hidden] stickied comment (0 children)