numbers = "51-52"
for st in numbers:
part = st.split("-")
print(part)
this is my code so far.
My results:['5']['1']['', '']['5']['2']
Expected:['51']['52']
numbers = "51-52"
for st in numbers:
part = st.split("-")
print(part)
this is my code so far.
My results:['5']['1']['', '']['5']['2']
Expected:['51']['52']
numbers = "51-52"
part = [int(x) for x in numbers.split("-")]
print(part)
for st in numbers
will iterate through each character in the string, so you end up with each character separate in the resulting set. Leave that out and simply
numbers = "51-52"
parts = numbers.split("-")
print(parts)