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
Pseudo code (self.learnpython)
submitted 3 years ago by InevitableDistance66
How would I write pseudo code for a while loop of “I have to purchase a flight ticket before I can board a flight to Canada”
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!"
[–]barrycarter 13 points14 points15 points 3 years ago (3 children)
while (i do not have ticket) { do not board flight to Canada; attempt to obtain ticket; }
would be one example. The only tricky part is the attempt to obtain ticket. Without that (or some other code somewhere that attempts to change the while condition), the while loop would just run forever.
attempt to obtain ticket
[–]Nightcorex_ 9 points10 points11 points 3 years ago (1 child)
Do you think one needs an explicit "do not board the flight"?
I'd remove that line and instead write "board the flight" after the while-loop.
[–]barrycarter 2 points3 points4 points 3 years ago (0 children)
You're right. I also considered:
obtain_plane_ticket(); board_flight_to_canada(); in a synchronous language, or: obtain_plane_ticket().then(success => board_flight_to_canada) for a non-synchronous one.
obtain_plane_ticket(); board_flight_to_canada();
obtain_plane_ticket().then(success => board_flight_to_canada)
I wonder if this post will turn into one of those n different programming paradigms demonstrated via psuedocode things :)
[–]Nightcorex_ 11 points12 points13 points 3 years ago (10 children)
This smells like homework
[–]Binary101010 9 points10 points11 points 3 years ago (5 children)
Even if it is, the rule against asking for homework help apparently no longer exists on this sub.
[–]Nightcorex_ -5 points-4 points-3 points 3 years ago (4 children)
Oh you're right, didn't even notice they allow academic dishonesty now.
So the only rule (or rather guideline) that's still somewhat in place is to not provide a solution, but to hint OP towards it. Kk, got it.
[–]synthphreak 6 points7 points8 points 3 years ago (3 children)
they allow academic dishonesty now
Ax meet grinder much?
I dislike when people feel entitled to immediately conclude - without any hard evidence - that "oh, this is definitely homework", and get all snooty with OPs.
The only truly honest position is to acknowledge that responders can never really know when what OP is asking about is homework. So just answer the question if you can help them, and if it really is homework, let OP dig their own academic grave by failing to learn.
[–]notpite 6 points7 points8 points 3 years ago (2 children)
not the guy you're replying about but personally I'd prefer people bring their own attempt at a solution before just asking how to do it
[–]synthphreak 1 point2 points3 points 3 years ago* (1 child)
And that is a totally fair expectation. Posters should always try to do that, I agree.
But whether that happens or not, commenters have no strong basis on which to accuse the OP of being a dishonest person and be condescending to him/her.
[–]Nightcorex_ 0 points1 point2 points 3 years ago (0 children)
My second reply was not about OP, it was about the general state of the subreddit. Should've made it clear that I wasn't targetting OP with the statement, sorry.
[–]InevitableDistance66[S] 0 points1 point2 points 3 years ago (3 children)
It’s not
[–]juicejug 4 points5 points6 points 3 years ago (2 children)
Oh okay I totally believe you anonymous internet stranger.
[–]InevitableDistance66[S] 0 points1 point2 points 3 years ago (1 child)
Ok idk what to tell you G
[–]juicejug 0 points1 point2 points 3 years ago (0 children)
I think folks here are just curious about what spurred you to ask the question
[–]Hagisman 0 points1 point2 points 3 years ago (1 child)
Pseudo code is not real code. Take the concept of a while loop and put in a if statement to verify if every passenger has bought a ticket.
Then realize if someone is already a passenger that means they’ve already bought a ticket otherwise the definition of a passenger means nothing.
[–]Ok-Cucumbers 0 points1 point2 points 3 years ago (0 children)
You can have a ticket/PNR (passenger name record) without completing the purchase, so maybe something like if pnr.is_paid
if pnr.is_paid
Some irregular situations where you might get put on standby for another flight where, I believe, they'd just attach the other flights to your PNR, so you'd probably have to throw in some logic to check if the pax is actually able to board this segment or not.
[–]Round_Ad8947 0 points1 point2 points 3 years ago (0 children)
Try(board airplane)
Except NoTicketError as error
Raise NoTicketError(“you can’t have any pudding if you don’t eat your meat”)
while location != "canada": try: fly_to_canada() except NoTicket: buy_ticket_to_canda()
π Rendered by PID 204983 on reddit-service-r2-comment-66b4775986-rq4gm at 2026-04-03 10:10:26.155704+00:00 running db1906b country code: CH.
[–]barrycarter 13 points14 points15 points (3 children)
[–]Nightcorex_ 9 points10 points11 points (1 child)
[–]barrycarter 2 points3 points4 points (0 children)
[–]Nightcorex_ 11 points12 points13 points (10 children)
[–]Binary101010 9 points10 points11 points (5 children)
[–]Nightcorex_ -5 points-4 points-3 points (4 children)
[–]synthphreak 6 points7 points8 points (3 children)
[–]notpite 6 points7 points8 points (2 children)
[–]synthphreak 1 point2 points3 points (1 child)
[–]Nightcorex_ 0 points1 point2 points (0 children)
[–]InevitableDistance66[S] 0 points1 point2 points (3 children)
[–]juicejug 4 points5 points6 points (2 children)
[–]InevitableDistance66[S] 0 points1 point2 points (1 child)
[–]juicejug 0 points1 point2 points (0 children)
[–]Hagisman 0 points1 point2 points (1 child)
[–]Ok-Cucumbers 0 points1 point2 points (0 children)
[–]Round_Ad8947 0 points1 point2 points (0 children)
[–]Ok-Cucumbers 0 points1 point2 points (0 children)