Skip to content

Commit

Permalink
Ejercicio 30.- Menú con funciones matemáticas [61]🐍👈👈👈
Browse files Browse the repository at this point in the history
  • Loading branch information
programadornovato committed Jul 9, 2020
1 parent 5719c59 commit da076c9
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions ejercicios/30FuncionesMatematicas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
def pedirNumeros():
a=int(input("Humano ingresa el valor de a:"))
b=int(input("Humano ingresa el valor de b:"))
os.system("cls")
return a,b
def suma(a,b):
return a+b
def resta(a,b):
return a-b
def mul(a,b):
return a*b
def div(a,b):
return a/b
def menu(a,b):
while True:
print(f"Que tipo de operacion matematica deseas realizar con {a} y {b}\n\
s para sumar\n\
r para restar\n\
m para multiplicar\n\
d para dividir\n\
x para salir:")
opcion=input()
if opcion=='s':
print(f"Resultado es:{suma(a,b)}")
if opcion=='r':
print(f"Resultado es:{resta(a,b)}")
if opcion=='m':
print(f"Resultado es:{mul(a,b)}")
if opcion=='d':
print(f"Resultado es:{div(a,b)}")
if opcion=='x':
break
input("Presione cualquier tecla")
os.system("cls")
a,b=pedirNumeros()
menu(a,b)

0 comments on commit da076c9

Please sign in to comment.