Hey everyone. I'm still new to python, and programming in general... I'm writing this bit of code that will ask for the user to input a 16 digit card number, and in return scramble the data in some manner... The scrambling isn't the part that is giving me trouble.
I'm using the list feature in python to create an empty list, then have the user input their credit card number, with each digit being a different element in the list. But I can't seem to make that happen. Whenever I then output the numbers, they appear as one long number in the list. I wanted so that each number is shifted individually Here's what I have so far.
#Credit Card Hash
Card_Number = list[] #Setting up the Card_Number variable as an empty list
i = (input( "Welcome. Please enter your 16 digit credit card number here: ")) #Sets the input from the user as i
Card_Number.append(i) # Adds the input from the user to the empty list of Card_Number
if i < 16 :
print ("Sorry, not enough digits provided. Please enter 16 digits")
else i >16:
print ("Sorry, too many digits provided. Please enter 16 digits.")
else i == 16:
print ("Thank you. Please hold...")
Now this is where I have trouble. How do I get the input to the list to be multiple items instead of just one 16 digit item on the list. For example, if they enter 1234567891234567 I want it to be entered into the list as [1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7] but when I run this, it becomes just [1234567891234567]. Any help is appreciated
If you see anything else wrong with the if statements let me know, I had some trouble with them as well. Sometimes the code never gets past the first if statement. Even if I enter a number that's over 16 digits. it still gives me the first if.
Thanks!



