[Python] How to add ! after name string? [duplicate]

Discussão em 'Python' iniciado por Stack, Setembro 15, 2024.

  1. Stack

    Stack Membro Participativo

    In the print tab at the bottom I am trying to add an exclamation point after the 'name' string, how do I do this without adding a space?

    # get name as a string
    name = input('What is your name? \n')
    # get age as an int
    age = int(input('How old are you? \n'))
    # calculate birth year
    birth_year = (2024 - age)
    # print greeting
    print('Hello', name, 'You were born in', birth_year)


    I tried putting it after the comma but it adds a space, any help would be appreciated.

    Continue reading...

Compartilhe esta Página