Afișați primele zecimale ale unui float: Revision history

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

28 December 2022

  • curprev 07:1907:19, 28 December 2022Cosmin.SABO talk contribs 388 bytes +388 Pagină nouă: == Cerinţa == Să se afișeze primele două zecimale ale variabilei pi == Date de intrare == pi = 3.1415926535 == Date de ieşire == Pi: 3.14 == Exemplu == ; Ieșire : Pi: 3.14 == Rezolvare == === Rezolvare ver. 1 === <syntaxhighlight lang="python" line> def print_pi(pi): print(f"Pi: {pi:.2f}") if __name__ == "__main__": pi = 3.1415926535 print_pi(pi) </syntaxhighlight>