Ad
  • Custom User Avatar

    1.) You need to return your output instead of printing to the console.

    2.) You need to change 2n+1 to 2*n+1.

    3.) You need to sort out your logic. You put n=0 and then do 2n+1 resulting in only two pathways - 0 or 1. This means a length of greater than 1 will not branch to the if statement, meaning None will be returned.

    4.) While loop is unecessary. Validation of input is okay, but change it from a while loop to an if statement. Also, change it from type == int to type == str.