Homepage Forums Dev & Debugging Spaces are not recognized Reply To: Spaces are not recognized

  • satyamukherjee

    Administrator
    March 30, 2021 at 8:15 pm
    11501 Coins
    567 Gems
    Helpful
    Up
    31
    Down
    Not Helpful

    Spaces are not defined in your program since you didn’t mention what to do with it.

    for i in range(len(text)):
    char = text[i]
    if (char.isupper()):
    result += chr((ord(char) + s - 65) % 26 + 65)
    elif (char.islower()):
    result += chr((ord(char) + s - 97) % 26 + 97)
    elif (char.isdigit()):
    result += str(int(char) + s)
    elif (char == '-'):
    result += '-'
    elif (char.ispace()):
    result += ''
    return result
    • This reply was modified 7 months ago by  satyamukherjee. Reason: corrected indentation
    • This reply was modified 7 months ago by  satyamukherjee.

New Report

Close