Search code examples
typeerrorpython-3.7

getting TypeError: '<' not supported between instances of 'tuple' and 'int'


def c_convert(str_one, str_two):
    i=0,
    j=0
    while i < len(str_one) and j < len(str_two):
        if str_one[i].upper() == str_two[j]:
            j +=1
        i +=1
    return j == len(str_two)
def main():
    q = int(input())
    for _ in range(q):
        str_one = input().strip()
        str_two = input().strip()
        if c_convert(str_one, str_two):
            print("Yes")
        else:
            print("No")
if __name__ == "__main__":
    main()
    

  • I am getting error-TypeError: '<' not supported between instances of 'tuple' and 'int' while executing the code , code is for comparing two strings.

I am getting runtime error. input : 2 daBcd ABC rACCEd ACED

Expected output: YES NO


Solution

  • i got my mistake, As I am using 'comma' after a = 0 and it is interpreted as tupple. after removing that my type error got fixed. Thanks