Advertisement
teslariu

Untitled

Nov 10th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. """
  5. Programa que calcula la superficie y el perimetro de figuras geometricas
  6. """
  7. def rectangulo(a,b):
  8.     perimetro = a*2+b*2
  9.     superficie = a*b
  10.     return [perimetro, superficie]
  11.  
  12. def circulo(radio):
  13.     pass
  14.    
  15. def cuadrado(a):
  16.     pass
  17.  
  18.  
  19. print("Calculo de perimetro y superficie")
  20. print("---------------------------------")
  21. while True:
  22.     print("Menu de opciones:")
  23.     print("a. Rectángulo")
  24.     print("b. Cuadrado")
  25.     print("c. Círculo")
  26.     print("z. Salir")
  27.     opcion = input("Seleccione una opción: ")
  28.    
  29.     if opcion == "a":
  30.         a = float(input("Ingrese el valor del lado mayor: "))
  31.         b = float(input("Ingrese el valor del lado menor: "))
  32.         valores = rectangulo(a,b)
  33.         print("Perimetro: ",valores[0])
  34.         print("Superficie: ",valores[1])
  35.        
  36.     elif opcion == "b":
  37.         a = float(input("Ingrese el valor del lado: "))
  38.    
  39.     elif opcion == "c":
  40.         r = float(input("Ingrese el valor del radio: "))
  41.    
  42.     elif opcion == "z":
  43.         print("Gracias por usar este programa...")
  44.         break
  45.    
  46.     else:
  47.         print("Opción incorrecta")
  48.    
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement