SHARE
TWEET

Untitled

a guest Feb 14th, 2020 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python3
  2. #Módulo IMC
  3. import sys
  4. def calc_imc(peso, altura):
  5.     """
  6.    Esta função calcula o imc
  7.    Entrada: peso em Kg e altura em metros
  8.    Saída: imc calculado (float)
  9.    """
  10.     imc = round(peso/(altura**2),2)
  11.     return imc
  12.  
  13. def main():
  14.     numargs = len(sys.argv)
  15.     if numargs < 3:
  16.         print("Uso: ", sys.argv[0] , "<peso> <altura>")
  17.         exit(1)
  18.     else:
  19.         peso = float(sys.argv[1])
  20.         altura = float(sys.argv[2])
  21.         I = calc_imc(peso,altura)
  22.         print(f"Seu imc é {I}")
  23.  
  24. if __name__ == '__main__':
  25.     main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top