-1

I don't know what I'm doing wrong here. Please help.

def AddColon (data):
    data.strip()  # --> to remove the spaces
    result = ''
    for i in range (len(data)):
        if str(data[i]).isalpha():  # to only include letters
            result = result + data[i]
    result.lower()     # to make everything lowercase
    result[0].upper()  # to make the first letter uppercase
    finalresult = result + ' : Hello'
    return finalresult

input1 = input('Insert Data : ')
print(AddColon(str(input1)))
B v
  • 1

1 Answers1

0

If your input contains any numbers or integers it may not go under if condition and the result will not be updated. To get a exact value, u may need to give only strings as input not alphanumeric.After that remove the indentation in for loop and if condition...try removing that and run your code. Your code and output is ready.