I'm trying to convert a user inputted string into a list of 2 digit numbers.
When the user enters a string, say "1234"
and I convert that into a list, it becomes [1,2,3,4]
. What I need it to become is [12,34]
and so on. How would one go about doing this?
print("Please insert string.") # User enters "12345678"
string1 = input()
list1 = list(string1) # "12345678" becomes [1,2,3,4,5,6,7,8]
if not any(char.isdigit() for char in string1):
print("Submission must be numbers only.")
else:
magically turn list1 into 2digitlist
print(2digitlist)
# Desired output: [12,34,56,78]
Hopefully there's a solution to this but I certainly have no clue what it is. That's what I get for trying to do something complex even though I have little experience I suppose. Thanks in advance.