-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathejercicio3.py
More file actions
executable file
·42 lines (38 loc) · 1005 Bytes
/
ejercicio3.py
File metadata and controls
executable file
·42 lines (38 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# **
# * ejercicio3.py
# *
# * Copyright 2011 Diego Hernandez <diego.herna@gmail.com>
# * Licencia http://www.gnu.org/copyleft/gpl.html GNU GPL v3 o posterior
# *
import sys
#
if __name__ == '__main__':
if len(sys.argv) != 4:
print "Faltan parametros"
else:
pass
operador1=int(sys.argv[1])
operacion=sys.argv[2]
operador2=int(sys.argv[3])
if operacion=='-':
# resta=operador1-operador2
# print resta
solucion=operador1-operador2
print 'el resultado es:',solucion
# print ("("+str(operador1)+"-"+str(operador2)")
elif operacion == '+':
solucion=operador1+operador2
print 'el resultado es:',solucion
# print "se suma"
elif operacion == '/':
solucion=operador1/operador2
print 'el resultado es:',solucion
# print "se divide"
elif operacion == '*':
# print "multiplica"
solucion=operador1*operador2
print 'el resultado es:',solucion
else:
print "El operador ingresado no es correcto"