Please enable JavaScript to use CodeHS

Utah Programación Informática 2

Description

El esquema de esta lección se centra en explicar los conceptos y la importancia de la E/S de archivos sin profundizar en la sintaxis de codificación. Proporciona una base para que los alumnos comprendan los fundamentos antes de sumergirse en los aspectos reales de la codificación en lecciones posteriores.

Objective

Students will be able to:

  • Define and explain file I/O.
  • Differentiate file types (e.g., text, binary).
  • Identify input sources and output destinations in computing.
  • Understand the purpose and significance of file input.
  • Understand the purpose and significance of file output.
  • Discuss real-world applications of file I/O.
Description

En esta lección, los alumnos aprenden a leer todos o un número determinado de caracteres de un archivo utilizando Python.

Objective

Students will be able to

  • Understand the importance of reading files and the role it plays in file handling tasks.
  • Use the open() function to open a file in read mode and the close() method to close the file properly.
  • Read the entire contents of a file using the read() method and store them in a variable
  • Handle common file exceptions, such as FileNotFoundError, when attempting to read a file.
Description

En esta lección, los alumnos aprenden a utilizar el método readline() para leer líneas de un archivo.

Objective

Students will be able to:

  • Understand the purpose and usage of the readline() method in Python for reading lines from a file.
  • Demonstrate how to open a file and use readline() to read a single line at a time.
  • Implement a loop to read and process multiple lines from a file using readline().
  • Handle end-of-file (EOF) situations by checking for an empty string returned by readline().
  • Adapt the readline() method to solve practical problems and perform operations on each line read from a file.
Description

En esta lección, los alumnos aprenden a utilizar el método readlines() de Python para leer varias líneas de un archivo, y practican la realización de diversas operaciones y manipulaciones en la línea

Objective

Students will be able to:

  • Understand the purpose and usage of the readlines() method in Python.
  • Read and retrieve multiple lines from a file using readlines().
  • Iterate through the lines obtained from readlines() and perform operations on each line.
  • Apply different manipulations and processing techniques to the lines read from a file.
  • Recognize the advantages and use cases of using readlines() in file handling scenarios.
Description

En esta lección, los alumnos aprenderán a escribir en archivos existentes. Explorarán dos modos: “w” para sobrescribir un archivo y “a” para añadir a un archivo.

Objective

Students will be able to:

  • Understand the purpose and importance of writing to files in programming.
  • Use the “w” mode to overwrite the contents of a file.
  • Use the “a” mode to append new data to the end of a file.
  • Demonstrate the ability to write text and data to a file using appropriate file handling techniques.
Description

En esta lección, los alumnos aprenderán a manipular la posición del puntero de un archivo utilizando el método seek() de Python. Explorarán cómo se puede utilizar buscar() para mover el puntero a una ubicación específica dentro de un archivo, permitiendo operaciones de lectura y escritura en las posiciones deseadas.

Objective

Students will be able to:

  • Understand the concept of a file pointer and its role in reading and writing data.
  • Use the seek() method to move the file pointer to a specific position within a file.
  • Perform reading operations at a desired file pointer position.
  • Perform writing operations at a specific location within a file.
  • Identify and handle potential errors or exceptions related to seek() operations.