'string editing on specific request split.upper/.lower

I'm trying to figure out how to edit the below to have a option to convert lower/upper(abc = ABC) I'd like to have a specific input that it knows to convert to the other. so input might be "convert_upper" the program now knows I want to convert the next input "abc" into " 'A', 'B', 'C' "

I've made it pretty far into this endeavor through forums but figuring out how to get the input1 to take a "special request" and do upper/lower based on that input has thrown me for loop Also I was curious how I can create the list. (a 2nd input that confirms the name for the list something like . . . )

example in/output^

input1 = numbers
 numbers = [] 
input2 = 123
numbers = ['1', '2', '3']

current code takes input such as "abc 123 !@#" and outputs a list ['a', 'b', 'c', ' ', '1', '2', '3', ' ', '!', '@', '#']

def split(word):
    return list(input1)
input1 = input("enter Letters, Numbers or Symbols: ")
print(split(input1))



Solution 1:[1]

Here's one approach: have a function that you apply to the input, and check for "special requests" to change it:

special_requests = {
    "convert_upper": str.upper,
    "convert_lower": str.lower,
    "vanilla": str
}
func = str

while True:
    i = input("? ")
    if i in special_requests:
        func = special_requests[i]
    else:
        print(func(i))
? abc123
abc123
? convert_upper
? abc123
ABC123

Solution 2:[2]

I'm not sure if I got you right but there is a specific method to turn strings into uppercase, which works like

my_upper_string = 'my_string'.upper()
print(my_upper_string) 

So for example:

print('abc'.upper())

will print 'ABC'.

Also, consider not re-defining a built-in python function. split() exists already with strings. I'd recommend to use another name to avoid weird behavior.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samwise
Solution 2 Dominic K.