1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How to increment the int variable inside the print statement in python?

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

  1. Stack

    Stack Membro Participativo

    I want to increment the variable inside the print statement, so it would not take 2 lines of code.

    I have the following code:

    yearCount += 1
    print("Year ",yearCount,":",sep = "")


    How can I do something like:

    print("Year",yearCount+=1,":",sep = "")

    Continue reading...

Compartilhe esta Página