Skip to main content
added 1 character in body
Source Link
lines
  • 31
  • 3

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and lensize) into variables.
  • Break down the large print statements into smaller and more readable sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and len) into variables.
  • Break down the large print statements into smaller and more readable sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and size) into variables.
  • Break down the large print statements into smaller and more readable sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    
added 2 characters in body
Source Link
lines
  • 31
  • 3

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and len) into variables.
  • Break down the large print statements into smaller, and more readable, sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and len) into variables.
  • Break down the large print statements into smaller, more readable, sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and len) into variables.
  • Break down the large print statements into smaller and more readable sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    
Forgot to add periods to 2 of the bullet points
Source Link
lines
  • 31
  • 3

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and len) into variables.
  • Break down the large print statements into smaller, more readable, sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2)
  • Convert calculations that are done multiple times (e.g. mid and len) into variables
  • Break down the large print statements into smaller, more readable, sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    

A big change would be to improve the readability of the program.

Some changes I would make are:

  • Add spacing between operators and make bracket style consistent (e.g. ((len(s)-1)//2) vs (len(s)-1)//2).
  • Convert calculations that are done multiple times (e.g. mid and len) into variables.
  • Break down the large print statements into smaller, more readable, sections; just making the code more verbose.
input_string = input("Enter string: ")
size = len(input_string)
mid = size // 2

for i in range(size):
    if i == mid:
        print(' ' * i + input_string[i])
        
    elif i > mid:
        left_space = ' ' * (size - 1 - i)
        middle_space = ' ' * (2 * i - size + 1)
        print(f"{left_space}{input_string[size-i-1]}{middle_space}{input_string[i]}")
        
    else:
        left_space = ' ' * i
        middle_space = ' ' * (size - 2 * i - 2)
        print(f"{left_space}{input_string[i]}{middle_space}{input_string[size-i-1]}")
    
Source Link
lines
  • 31
  • 3
Loading