-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 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,53 @@ | ||
|
||
import os | ||
|
||
|
||
def limpiar_pantalla(): | ||
""" | ||
Limpia la consola según el sistema operativo. | ||
""" | ||
os.system('clear' if os.name == 'posix' else 'cls') | ||
|
||
|
||
def pausa(): | ||
""" | ||
Pausa la ejecución del programa hasta que se pulse ENTER. | ||
""" | ||
input("\nPresione ENTER para continuar...") | ||
limpiar_pantalla() | ||
|
||
|
||
def main(): | ||
asignaturas = ["Mates", "Lengua", "Inglés", "Física", "Química", "Historia"] | ||
|
||
limpiar_pantalla() | ||
|
||
print(asignaturas) | ||
|
||
pausa() | ||
|
||
for asignatura in asignaturas: | ||
print(asignatura) | ||
|
||
pausa() | ||
|
||
for i in range(len(asignaturas)): | ||
if i < len(asignaturas) - 1: | ||
print(asignaturas[i], end = " - ") | ||
else: | ||
print(asignaturas[i] + ".") | ||
|
||
pausa() | ||
|
||
pos = 0 | ||
frase = "" | ||
while pos < len(asignaturas): | ||
frase += asignaturas[pos] + ", " | ||
pos += 1 | ||
print(frase[:-2] + '.') | ||
|
||
pausa() | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |