Hi guys, I am relatively new to Python. I am trying to code a program in Python and part of it involves checking that each input only have the characters 1 to 9 occuring only once.
My code are as follow:
for i in range(1,3):
num = str(raw_input("Enter row " + str(i-1) + ": "))
Output will be as follows with input added to the raw input statement:
Enter row 0: 112233445
Enter row 1: 112233445
Now I want the code to display two respective error message after both inputs because both inputs have the characters 1 to 9 occuring more than once. Something with an output like:
row 0 is invalid
row 1 is invalid
Problem is, I used a second for loop below the first to display only the error messages. The second for loop is not able to detect the input in row 0 but rather reads only row 1.
Is there a way to bring all the input recieved in the first for loop (both row 0 and row 1), and evaluate them both in a second loop, hence, producing my desired output above?