[Python] Why is right_justify function not producing output in the Python automarker?

Discussão em 'Python' iniciado por Stack, Março 22, 2025.

  1. Stack

    Stack Membro Participativo

    Write a function named right_justify that takes a string named input_string as a parameter. If the input string is longer than 79 characters, the string should be printed as is, Otherwise, the function should print the string with enough leading spaces that the last letter of the string is in column 80 of the display.

    I did this on python on my computer and it seems to work, however when i put it into the python automarker it has no output whatsoever... what am i doing wrong???

    def right_justify(input_string):
    spaces = 80 - len(input_string)
    spaces_in_front = spaces * " "
    if len(input_string)>79:
    print(input_string)
    else:
    print (spaces_in_front + input_string)

    Continue reading...

Compartilhe esta Página