1
.
)
EJercicio
1
:
def
main
(
)
:
condicion
=
1
____________________
(
condicion
=
=
1
)
:
opcion
=
____________________
(
"
1
-
>
Registrar
2
-
>
Consultar
3
-
-
>
Salir
"
)
if
opcion
=
=
'3'
:
print
(
"
Fin
del
programa
"
)
condicion
=
0
elif
(
opcion
=
=
'1'
)
:
print
(
"
Registrar
"
)
____________________
(
opcion
=
=
'2'
)
:
____________________
(
"
Consultar
"
)
else
:
print
(
"
Seleccione
entre
1
y
3
"
)
if
__name__
=
=
'__main__'
:
main
(
)
2
.
)
Ejercicio
2
:
def
____________________
(
)
:
n
=
____________________
(
input
(
"
Digite
un
numero
n
:
"
)
)
i
=
1
suma
=
0
while
(
i
=
50
____________________
numero<
=
100
:
print
(
"
El
numero
se
encuentra
en
el
rango
entre
50
-
100
"
)
____________________
:
____________________
(
"
Numero
fuera
del
rango
"
)
if
__name__
=
=
'__main__'
:
main
(
)
3
.
)
Ejercicio
3
:
def
____________________
(
)
:
zona
=
input
(
"
Digite
la
zona
(
U
o
R
)
:
"
)
if
zona
=
=
'U'
____________________
zona
=
=
'u'
:
print
(
"
La
persona
pertenece
a
la
zona
Urbana
"
)
____________________
(
zona
=
=
'R'
____________________
zona
=
=
'r'
)
:
____________________
(
"
La
persona
pertenece
a
la
zona
Rural
"
)
else
:
print
(
"
Escoja
U
o
R
para
definir
la
zona
de
la
persona
"
)
if
__name__
=
=
'__main__'
:
main
(
)
4
.
)
Ejercicio
4
:
def
main
(
)
:
#1
+
2
+
3
=
6
#28
=
1
+
2
+
4
+
7
+
14
numero
=
int
(
input
(
"
Digite
el
numero
:
"
)
)
##6
sum
=
6
i
=
3
sum
=
0
____________________
i
____________________
range
(
1
,
numero
)
:
if
numero%i
=
=
0
:
sum
=
sum
+
i
____________________
sum
=
=
numero
:
____________________
(
"
El
numero
"
,
numero
,
"
Es
perfecto
"
)
else
:
print
(
"
El
numero
"
,
numero
,
"
no
es
perfecto
"
)
if
__name__
=
=
'__main__'
:
____________________
(
)
5
.
)
Ejercicio
5
:
def
main
(
)
:
n
=
int
(
____________________
(
"
Digite
un
numero
n
:
"
)
)
i
=
1
suma
=
0
____________________
(
i<
=
n
)
:
print
(
i
,
end
=
"
-
"
)
suma
=
suma
+
i
i
=
i
+
1
____________________
(
"
\
nLa
suma
de
los
numeros
ingresados
es
:
"
,
suma
)
if
__name__
=
=
'__main__'
:
main
(
)