'Need help returning the input variable with an if statement

I am new to stackoverflow and python, is it possible to return the utility function within the class type function and then sort it by the class input? Let me know if you have any suggestions or help. Thanks

rates = pd.read_csv('data')

CNP_TDSP= rates.loc[(rates['TDSP'] == 'CNP')]
TNMP_TDSP= rates.loc[(rates['TDSP'] == 'TNMP')]
AEPC_TDSP= rates.loc[(rates['TDSP'] == 'AEPC')]
AEPN_TDSP= rates.loc[(rates['TDSP'] == 'AEPN')]
ONC_TDSP= rates.loc[(rates['TDSP'] == 'ONC')]

TDSP_OPTIONS = ['CNP', 'TNMP', 'AEPC', 'AEPN', 'ONC']
print(TDSP_OPTIONS)

userInput = input('Enter tdsp:')
class_input = input('Enter class type:')


def utility():
    if userInput == 'CNP':
        display(CNP_TDSP)
    if userInput == 'TNMP':
        display(TNMP_TDSP) 
    if userInput == 'AEPC':
        display(AEPC_TDSP)
    if userInput == 'AEPN':
        display(AEPN_TDSP)
    if userInput == 'ONC':
        display(ONC_TDSP)        


utility()

def class_type():
    if class_input == 'Resi':
        display(utility['Class'] == 'Resi)

class_type()

output: File "/tmp/ipykernel_28447/2787243890.py", line 37 display(utility['Class'] == 'Resi) SyntaxError: EOL while scanning string literal



Solution 1:[1]

def class_type():
    if class_input == 'Resi':
        display(utility['Class'] == 'Resi)

Add a quote after 'Resi

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 RiveN