Added a for loop and prompt

Added a for loop to check the input provided in the prompt function.