Run
# Take a numeric string range x = '4-9' # Split the string by hypehn a, b = x.split('-') # Convert string splits into integers a, b = int(a), int(b) # Create a range from the given values result = range(a, b + 1) # Convert the range into list result = list(result) print(result)
Output