Advertisement
Sergio_Istea

fstring.py

Mar 30th, 2023 (edited)
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3.  
  4. var_entero = 3
  5. var_float = 3.732452340095
  6.  
  7.  
  8. result_exp= var_entero + var_float
  9.  
  10. #                              objeto          objeto         funcion(objeto, int)
  11. output_3_digits = f'La Suma de {var_entero} + {var_float} es {round(result_exp, 3)}'
  12.  
  13. #                                  objeto          objeto         funcion(expresion)
  14. output_int_rounded = f'La Suma de {var_entero} + {var_float} es {round(var_entero + var_float)}'
  15.  
  16. print(f'{output_3_digits} // 3 digits trim')
  17.  
  18. print(f'{output_int_rounded} // integer rounded')
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement