SubhanUllah Posted October 3, 2022 Report Posted October 3, 2022 (edited) I make this answer using Python programming language, this is very similar to pseudocode: limit_patience = 10 you_understand = False while not you_understand: for intents in range(limit_patience, 0, -1): # loop while I have patience print("I'll teach you about if-else, for and while loops") # I'll explain your_answer = input("If you understood, write 'Yes'") # Do you know now? if your_answer == "Yes": # You answer me print("Congratulations: you are a genius") you_understand = True break # exit inner loop else: # if not write 'Yes' print(F"Ok, I'll keep teaching you by {intents} time") # say this sentence print("I teach again, AGAIN!") # this is inside the main loop # the loop to repeat to this point else: # you have reached the limit of my patience # the else clause of the for loop exits here when the loop reaches its normal end, # not when it exits via a break clause print("My God: you're a donkey") break # breaks out of the main loop else: # the else clause of the while loop exits here when the loop ends normally, # that is when the while condition is not met print("You already know if-else, for and while loops") # I hope I'm not wrong Edited October 3, 2022 by SubhanUllah Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.