Created
May 26, 2018 23:29
-
-
Save pablovv72/7c8a8927d873b32eb2bc4f86535f8b46 to your computer and use it in GitHub Desktop.
switch.py
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
opciones = { | |
1: 'print("has elegido la opción 1")', | |
2: 'print("has elegido la opción 2")', | |
3: 'print("has elegido la opción 3")', | |
4: 'print("has elegido la opción 4")', | |
5: 'print("has elegido la opción 5")' | |
} | |
opc = input('Introduce tu opción [1-5]: ') | |
eval(opciones[int(opc)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Una alternativa al switch/case