[Python] How would I rewrite this python-2 code using f-strings?

Discussão em 'Python' iniciado por Stack, Dezembro 1, 2025.

  1. Stack

    Stack Membro Participativo

    while I read this

    that has this code

    We can also do that this way:
    We'd have 500000 beans, 500 jars, and 5 crates.


    when I revised to pep 498

    print ("We can also do that this way:")
    print (f"We'd have {secret_formula(start_point)} beans, {secret_formula(start_point)} jars, and {secret_formula(start_point)} crates.")


    it print this

    We can also do that this way:
    We'd have (500000, 500, 5) beans, (500000, 500, 5) jars, and (500000, 500, 5) crates.

    Continue reading...

Compartilhe esta Página