i am totally new to python and I have this code snippet of c++ :
do
{
cout << "Make sure the number of digits are exactly 12 : ";
cin >> input ;
} while((input.length()) != 12 );
How do I change this part to python ? I have tried this so far , I don't get what the right syntax or logic flow it will be . This is what I have :
while True:
print("Make sure the number of digits are exactly 12 : ")
input = raw_input()
check = len(input)
if check != 12
break
The above part is solved !
Also , another c++ snippet that is : input is string
for (int i = 0; i < 12 ; i++)
{
code[i] = input.at(i) - '0';
}
I cannot figure out how to change this part to python code
code[i] = input.at(i) - '0';
So, the problem i am having is I can't figure out how to initialize the array
int code[12] ;
How should that be in python so the i can execute this piece of code ! as given :
int code[12] ;
for (int i = 0; i < 12 ; i++)
{
code[i] = input.at(i) - '0';
}