I wanted to ask that how can I make my program loop with basic code, (pls don’t recommend cryptic ones) such as if a user types 1 it reruns the program and if they type anything else, the program ends soo please help me in this problem.
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
2
Answers
Use a
while True
loop and break out of it when a certain condition is met:You have two options:
Iteration
Use an infinite
while True
loop and break out if the user enters1
Recursion
Create a recursive function which returns if the user enters
1