I am trying to make a queue system in which I have written a code that is working fine but that code is just a one-time flow i.e. you run once and then you get the output.
But I want to make it as a real-time application that would take request and give output to the user’s input and this should function should run parallelly.
So currently, I have coded it in python and I have a very vague knowledge of how real-time application works. So, I would be glad if someone could help me through it.
I’m a beginner myself but creating a main loop sounds like it would work for you.
def main():
a = input("Enter a number or type exit to exit ")
if a =="exit":
exit()
else:
b = int(input("Enter another number "))
c = int(a) * b
print(c)
main()
print("Welcome to the most useless calculator in the world")
main()
what this does is when it has run through your code in this case printed c it calls the main function again, this creates and infinite loop untill you type exit wich then closes the app.
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.