Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
DELGADO VALENCIA, JORGE
ptavi-p2
Commits
43aba8bd
Commit
43aba8bd
authored
Oct 09, 2019
by
DELGADO VALENCIA, JORGE
💀
Browse files
Delete esqueleto-oo.py
parent
d6dff900
Changes
1
Hide whitespace changes
Inline
Side-by-side
esqueleto-oo.py
deleted
100644 → 0
View file @
d6dff900
#!/usr/bin/python3
# -*- coding: utf-8 -*-
class
Calculadora
():
"Esto es un ejemplo de clase que hereda de ClaseMadre"
#def __init__(self, valor):
def
_init_
(
self
,
operador
,
operando1
,
operando2
)
:
#"Esto es el método iniciliazador"
#self.atributo = valor
self
.
operador
=
operador
self
.
operando1
=
operando1
self
.
operando2
=
operando2
def
if
__name__
==
"__main__"
:
if
sys
.
argv
[
2
]
==
"suma"
:
result
=
plus
(
operando1
,
operando2
)
#if self.operador == "suma" :
#return self.suma()
elif
sys
.
argv
[
2
]
==
"resta"
:
result
=
minus
(
operando1
,
operando2
)
#elif self.operador == "resta"
#return self.resta()
else
:
sys
.
exit
(
'Operación sólo puede ser sumar o restar.'
)
objeto
=
Clase
(
"pepe"
)
# Creo un objeto de la clase Clase
# y le paso el valor pepe para su
# atributo en la inicialización
try
:
operando1
=
int
(
sys
.
argv
[
1
])
operando2
=
int
(
sys
.
argv
[
3
])
except
ValueError
:
sys
.
exit
(
"Error: Non numerical parameters"
)
if
sys
.
argv
[
2
]
==
"suma"
:
result
=
plus
(
operando1
,
operando2
)
elif
sys
.
argv
[
2
]
==
"resta"
:
result
=
minus
(
operando1
,
operando2
)
else
:
sys
.
exit
(
'Operación sólo puede ser sumar o restar.'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment