-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ejercicio 30.- Menú con funciones matemáticas [61]🐍👈👈👈
Video: https://youtu.be/LpqsxEpzCpc
- Loading branch information
1 parent
5719c59
commit da076c9
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |